virtual wxControl *GetWidget() const { return m_srchCtrl; }
virtual wxTextEntryBase *GetTextEntry() const { return m_srchCtrl; }
- virtual void RecreateWidget() { CreateControl(); }
+ virtual void RecreateWidget();
// lazy creation of the content
virtual void CreateContent();
void OnToggleSearchMenu(wxCommandEvent&);
void OnSearch(wxCommandEvent& event);
+ void OnSearchCancel(wxCommandEvent& event);
wxMenu* CreateTestMenu();
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()
// ============================================================================
wxSize(150, -1), style);
}
+void SearchCtrlWidgetsPage::RecreateWidget()
+{
+ CreateControl();
+
+ GetSizer()->Add(m_srchCtrl, wxSizerFlags().Centre().TripleBorder());
+
+ Layout();
+}
wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
{
wxLogMessage("Search button: search for \"%s\".", event.GetString());
}
+void SearchCtrlWidgetsPage::OnSearchCancel(wxCommandEvent& event)
+{
+ wxLogMessage("Cancel button pressed.");
+
+ event.Skip();
+}
+
#endif // wxUSE_SEARCHCTRL