]> git.saurik.com Git - wxWidgets.git/commitdiff
Restore propagation of EVT_SEARCHCTRL_CANCEL_BTN events to the parent.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Nov 2012 23:56:21 +0000 (23:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 6 Nov 2012 23:56:21 +0000 (23:56 +0000)
This was broken by r72581, add event.Skip() call to the handler for this event
added there.

Also add a handler for this event to the corresponding page of the widgets
sample to be able to test this.

Closes #14799.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/widgets/searchctrl.cpp
src/generic/srchctlg.cpp

index 7ba5df5a9337108b9c3c5c7019ea99cb9f6ad443..4c8e900c406ab74759fbb8769864683c2b536c34 100644 (file)
@@ -85,6 +85,7 @@ protected:
     void OnToggleSearchMenu(wxCommandEvent&);
 
     void OnSearch(wxCommandEvent& event);
+    void OnSearchCancel(wxCommandEvent& event);
 
     wxMenu* CreateTestMenu();
 
@@ -112,6 +113,7 @@ BEGIN_EVENT_TABLE(SearchCtrlWidgetsPage, WidgetsPage)
     EVT_CHECKBOX(ID_MENU_CB, SearchCtrlWidgetsPage::OnToggleSearchMenu)
 
     EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, SearchCtrlWidgetsPage::OnSearch)
+    EVT_SEARCHCTRL_CANCEL_BTN(wxID_ANY, SearchCtrlWidgetsPage::OnSearchCancel)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -231,4 +233,11 @@ void SearchCtrlWidgetsPage::OnSearch(wxCommandEvent& event)
     wxLogMessage("Search button: search for \"%s\".", event.GetString());
 }
 
+void SearchCtrlWidgetsPage::OnSearchCancel(wxCommandEvent& event)
+{
+    wxLogMessage("Cancel button pressed.");
+
+    event.Skip();
+}
+
 #endif  //  wxUSE_SEARCHCTRL
index acf408c2dd4a8ab7e9cb5dcbc4db74100d6c0765..91000de3cb9a7a2124571ef2deb1322c3e562626 100644 (file)
@@ -1176,9 +1176,10 @@ void wxSearchCtrl::RecalcBitmaps()
     }
 }
 
-void wxSearchCtrl::OnCancelButton( wxCommandEvent& WXUNUSED(event) )
+void wxSearchCtrl::OnCancelButton( wxCommandEvent& event )
 {
     m_text->Clear();
+    event.Skip();
 }
 
 void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ )