+void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
+{
+ wxLogMessage("OnBeginLabelEdit");
+
+ // for testing, prevent this items label editing
+ wxTreeItemId itemId = event.GetItem();
+ if ( IsTestItem(itemId) )
+ {
+ wxMessageBox("You can't edit this item.");
+
+ event.Veto();
+ }
+}
+
+void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
+{
+ wxLogMessage("OnEndLabelEdit");
+
+ // don't allow anything except letters in the labels
+ if ( !event.GetLabel().IsWord() )
+ {
+ wxMessageBox("The label should contain only letters.");
+
+ event.Veto();
+ }
+}
+