Added wxEVT_COMMAND_DIRCTRL_CHANGED for wxDirCtrl selection changes.

This makes it much simpler to react to the changes in the control, update the
sample to show it.

Closes #14792.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-11-01 17:15:08 +00:00
parent 0d6f66f45c
commit 84605707d1
5 changed files with 47 additions and 0 deletions

View File

@@ -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