Ensure that wxDatePickerCtrlGeneric does get focus events

Revert 1de107c037 and remove the focus
event handler which duplicated and interfered with the handler inherited
from this class to make sure that we get wxEVT_{SET,KILL}_FOCUS for the
objects of this class.

Unfortunately these events now come in pairs, due to an extra artificial
event generated by wxComboBoxExtraInputHandler::OnFocus(), which is
still wrong -- but arguably less wrong and more useful than not sending
them at all.
This commit is contained in:
Vadim Zeitlin 2018-07-22 19:12:17 +02:00
parent 8dfd799fd5
commit 97e217e175
2 changed files with 1 additions and 11 deletions

View File

@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl;
class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup;
class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric
: public wxCompositeWindowSettersOnly< wxNavigationEnabled<wxDatePickerCtrlBase> >
: public wxCompositeWindow< wxNavigationEnabled<wxDatePickerCtrlBase> >
{
public:
// creating the control
@ -80,7 +80,6 @@ private:
void OnText(wxCommandEvent &event);
void OnSize(wxSizeEvent& event);
void OnFocus(wxFocusEvent& event);
#ifdef __WXOSX_COCOA__
virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) wxOVERRIDE { }

View File

@ -296,7 +296,6 @@ wxEND_EVENT_TABLE()
wxBEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase)
EVT_TEXT(wxID_ANY, wxDatePickerCtrlGeneric::OnText)
EVT_SIZE(wxDatePickerCtrlGeneric::OnSize)
EVT_SET_FOCUS(wxDatePickerCtrlGeneric::OnFocus)
wxEND_EVENT_TABLE()
#ifndef wxHAS_NATIVE_DATEPICKCTRL
@ -485,12 +484,4 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev)
m_popup->SendDateEvent(dt);
}
void wxDatePickerCtrlGeneric::OnFocus(wxFocusEvent& WXUNUSED(event))
{
m_combo->SetFocus();
}
#endif // wxUSE_DATEPICKCTRL