Log EVT_TEXT_ENTER events for wxSearchCtrl in the widgets sample

This is convenient for checking that the behaviour is consistent among
different platforms.

See #17911.
This commit is contained in:
Vadim Zeitlin 2018-01-29 19:40:03 +01:00
parent f24872f6f4
commit f079f11736

View File

@ -83,6 +83,8 @@ protected:
void OnToggleCancelButton(wxCommandEvent&);
void OnToggleSearchMenu(wxCommandEvent&);
void OnTextEnter(wxCommandEvent& event);
void OnSearch(wxCommandEvent& event);
void OnSearchCancel(wxCommandEvent& event);
@ -114,6 +116,8 @@ wxBEGIN_EVENT_TABLE(SearchCtrlWidgetsPage, WidgetsPage)
EVT_CHECKBOX(ID_CANCEL_CB, SearchCtrlWidgetsPage::OnToggleCancelButton)
EVT_CHECKBOX(ID_MENU_CB, SearchCtrlWidgetsPage::OnToggleSearchMenu)
EVT_TEXT_ENTER(wxID_ANY, SearchCtrlWidgetsPage::OnTextEnter)
EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, SearchCtrlWidgetsPage::OnSearch)
EVT_SEARCHCTRL_CANCEL_BTN(wxID_ANY, SearchCtrlWidgetsPage::OnSearchCancel)
wxEND_EVENT_TABLE()
@ -233,6 +237,12 @@ void SearchCtrlWidgetsPage::OnToggleSearchMenu(wxCommandEvent&)
m_srchCtrl->SetMenu(NULL);
}
void SearchCtrlWidgetsPage::OnTextEnter(wxCommandEvent& event)
{
wxLogMessage("Search control: enter pressed, contents is \"%s\".",
event.GetString());
}
void SearchCtrlWidgetsPage::OnSearch(wxCommandEvent& event)
{
wxLogMessage("Search button: search for \"%s\".", event.GetString());