]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/searchctrl.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / samples / widgets / searchctrl.cpp
index 7ba5df5a9337108b9c3c5c7019ea99cb9f6ad443..32739204796f271033c626ff678fd9d048eae290 100644 (file)
@@ -4,7 +4,6 @@
 // Purpose:     Shows wxSearchCtrl
 // Author:      Robin Dunn
 // Created:     9-Dec-2006
-// Id:          $Id$
 // Copyright:   (c) 2006
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -85,6 +84,7 @@ protected:
     void OnToggleSearchMenu(wxCommandEvent&);
 
     void OnSearch(wxCommandEvent& event);
+    void OnSearchCancel(wxCommandEvent& event);
 
     wxMenu* CreateTestMenu();
 
@@ -112,6 +112,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()
 
 // ============================================================================
@@ -196,7 +197,7 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
 //     target->Connect(
 //         ID_SEARCHMENU,
 //         ID_SEARCHMENU+SEARCH_MENU_SIZE,
-//         wxEVT_COMMAND_MENU_SELECTED,
+//         wxEVT_MENU,
 //         wxCommandEventHandler(MySearchCtrl::OnSearchMenu)
 //         );
     return menu;
@@ -231,4 +232,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