void MyFrame::OnTreeSelection(wxTreeEvent& event) { wxString label = event.GetLabel(); // Do something with the selected item's label }
void MyFrame::OnTreeEndLabelEdit(wxTreeEvent& event) { wxString label = event.GetLabel(); // Update the item's label in the tree control event.GetItem()->SetText(label); }In this example, the OnTreeEndLabelEdit function is called when the user finishes editing the label of an item in the tree control. The function uses the GetLabel function to retrieve the new label, and then updates the item's label in the tree control using the SetText function. Package library: wxWidgets