Log focus messages for the search control in the widgets sample
This makes it easier to test various issues related to focus events for composite controls, such as wxSearchCtrl.
This commit is contained in:
parent
26997607b6
commit
21823bd37a
1 changed files with 20 additions and 0 deletions
|
|
@ -86,6 +86,9 @@ protected:
|
|||
void OnSearch(wxCommandEvent& event);
|
||||
void OnSearchCancel(wxCommandEvent& event);
|
||||
|
||||
void OnSetFocus(wxFocusEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
|
||||
wxMenu* CreateTestMenu();
|
||||
|
||||
// (re)create the control
|
||||
|
|
@ -171,6 +174,9 @@ void SearchCtrlWidgetsPage::CreateControl()
|
|||
|
||||
m_srchCtrl = new wxSearchCtrl(this, -1, wxEmptyString, wxDefaultPosition,
|
||||
wxSize(150, -1), style);
|
||||
|
||||
m_srchCtrl->Bind(wxEVT_SET_FOCUS, &SearchCtrlWidgetsPage::OnSetFocus, this);
|
||||
m_srchCtrl->Bind(wxEVT_KILL_FOCUS, &SearchCtrlWidgetsPage::OnKillFocus, this);
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::RecreateWidget()
|
||||
|
|
@ -239,4 +245,18 @@ void SearchCtrlWidgetsPage::OnSearchCancel(wxCommandEvent& event)
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
wxLogMessage("Search control got focus");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void SearchCtrlWidgetsPage::OnKillFocus(wxFocusEvent& event)
|
||||
{
|
||||
wxLogMessage("Search control lost focus");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#endif // wxUSE_SEARCHCTRL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue