diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 759c7c5067..4d290c364a 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -115,6 +115,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) MENU_LINK(SetImageSize) MENU_LINK(CollapseAndReset) MENU_LINK(EnsureVisible) + MENU_LINK(SetFocus) MENU_LINK(AddItem) MENU_LINK(InsertItem) MENU_LINK(IncIndent) @@ -265,6 +266,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible")); + tree_menu->Append(TreeTest_SetFocus, wxT("Set &focus to the tree")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I")); tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R")); @@ -713,6 +715,11 @@ void MyFrame::OnEnsureVisible(wxCommandEvent& WXUNUSED(event)) m_treeCtrl->DoEnsureVisible(); } +void MyFrame::OnSetFocus(wxCommandEvent& WXUNUSED(event)) +{ + m_treeCtrl->SetFocus(); +} + void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event)) { int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_File : -1; diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 8fd17755c3..c9c692eb73 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -228,6 +228,7 @@ public: void OnClearBold(wxCommandEvent& WXUNUSED(event)) { DoSetBold(false); } void OnEnsureVisible(wxCommandEvent& event); + void OnSetFocus(wxCommandEvent& event); void OnCount(wxCommandEvent& event); void OnCountRec(wxCommandEvent& event); @@ -339,6 +340,7 @@ enum TreeTest_ToggleSel, TreeTest_CollapseAndReset, TreeTest_EnsureVisible, + TreeTest_SetFocus, TreeTest_AddItem, TreeTest_InsertItem, TreeTest_IncIndent,