X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7156681007c718be299389f68326b1c71486878..f0facad09d3633455d338cba9036df6922c98cb4:/samples/widgets/dirctrl.cpp?ds=inline diff --git a/samples/widgets/dirctrl.cpp b/samples/widgets/dirctrl.cpp index 0698b926de..6a55991d55 100644 --- a/samples/widgets/dirctrl.cpp +++ b/samples/widgets/dirctrl.cpp @@ -112,6 +112,7 @@ protected: void OnStdPath(wxCommandEvent& event); void OnCheckBox(wxCommandEvent& event); void OnRadioBox(wxCommandEvent& event); + void OnSelChanged(wxTreeEvent& event); // reset the control parameters void Reset(); @@ -154,6 +155,7 @@ BEGIN_EVENT_TABLE(DirCtrlWidgetsPage, WidgetsPage) EVT_BUTTON(DirCtrlPage_SetPath, DirCtrlWidgetsPage::OnButtonSetPath) EVT_CHECKBOX(wxID_ANY, DirCtrlWidgetsPage::OnCheckBox) EVT_RADIOBOX(wxID_ANY, DirCtrlWidgetsPage::OnRadioBox) + EVT_DIRCTRL_CHANGED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnSelChanged) END_EVENT_TABLE() // ============================================================================ @@ -168,6 +170,7 @@ DirCtrlWidgetsPage::DirCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) :WidgetsPage(book, imaglist, dirctrl_xpm) { + m_dirCtrl = NULL; } void DirCtrlWidgetsPage::CreateContent() @@ -360,4 +363,15 @@ void DirCtrlWidgetsPage::OnRadioBox(wxCommandEvent& WXUNUSED(event)) } } +void DirCtrlWidgetsPage::OnSelChanged(wxTreeEvent& event) +{ + if ( m_dirCtrl ) + { + wxLogMessage("Selection changed to \"%s\"", + m_dirCtrl->GetPath(event.GetItem())); + } + + event.Skip(); +} + #endif // wxUSE_DIRDLG