From 97e217e175c0c4929e88efb3eed9ef56a52757ca Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Jul 2018 19:12:17 +0200 Subject: [PATCH] Ensure that wxDatePickerCtrlGeneric does get focus events Revert 1de107c03706de5e1864f7e167d29eea93df066f 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. --- include/wx/generic/datectrl.h | 3 +-- src/generic/datectlg.cpp | 9 --------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/include/wx/generic/datectrl.h b/include/wx/generic/datectrl.h index 09d340739d..4276ff853a 100644 --- a/include/wx/generic/datectrl.h +++ b/include/wx/generic/datectrl.h @@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric - : public wxCompositeWindowSettersOnly< wxNavigationEnabled > + : public wxCompositeWindow< wxNavigationEnabled > { 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 { } diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 767a7454df..d5abccfd3a 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -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 -