This should be the desired behaviour in the vast majority of cases, so do it
by default.
Replace the useless OnSearchButton() doing nothing with search button events
with OnCancelButton() handling cancel button events and clearing the control.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72581
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop );
virtual wxBitmap RenderCancelBitmap( int x, int y );
- virtual void OnSearchButton( wxCommandEvent& event );
+ void OnCancelButton( wxCommandEvent& event );
void OnSetFocus( wxFocusEvent& event );
void OnSize( wxSizeEvent& event );
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
- EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton)
+ EVT_SEARCHCTRL_CANCEL_BTN(wxID_ANY, wxSearchCtrl::OnCancelButton)
EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus)
EVT_SIZE(wxSearchCtrl::OnSize)
END_EVENT_TABLE()
}
}
-void wxSearchCtrl::OnSearchButton( wxCommandEvent& event )
+void wxSearchCtrl::OnCancelButton( wxCommandEvent& WXUNUSED(event) )
{
- event.Skip();
+ m_text->Clear();
}
void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ )