X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85fa9d60c470e58fe8ff3589b0516cbbe853cbb0..38f74dffc11f9afca3e1ad20ac2b1146fc75a1b3:/src/generic/datectlg.cpp diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index d22073d67e..fbdbdb8bb6 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -70,14 +70,6 @@ // global variables // ---------------------------------------------------------------------------- -// this should have been a flag in wxDatePickerCtrlGeneric itself but adding it -// there now would break backwards compatibility, so put it here as a global: -// this shouldn't be a big problem as only one (GUI) thread normally can call -// wxDatePickerCtrlGeneric::SetValue() and so it can be only ever used for one -// control at a time -// -// if the value is not NULL, it points to the control which is inside SetValue() -static wxDatePickerCtrlGeneric *gs_inSetValue = NULL; // ---------------------------------------------------------------------------- // local classes @@ -378,6 +370,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase) EVT_TEXT(wxID_ANY, wxDatePickerCtrlGeneric::OnText) EVT_SIZE(wxDatePickerCtrlGeneric::OnSize) + EVT_SET_FOCUS(wxDatePickerCtrlGeneric::OnFocus) END_EVENT_TABLE() #ifndef wxHAS_NATIVE_DATEPICKCTRL @@ -412,15 +405,21 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, m_combo = new wxComboCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize); + m_combo->SetCtrlMainWnd(this); + m_popup = new wxCalendarComboPopup(); +#if defined(__WXMSW__) + // without this keyboard navigation in month control doesn't work + m_combo->UseAltPopupWindow(); +#endif m_combo->SetPopupControl(m_popup); m_cal = m_popup; m_popup->SetDateValue(date.IsValid() ? date : wxDateTime::Today()); - SetBestFittingSize(size); + SetInitialSize(size); return true; } @@ -528,6 +527,12 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev) } +void wxDatePickerCtrlGeneric::OnFocus(wxFocusEvent& WXUNUSED(event)) +{ + m_combo->SetFocus(); +} + + #endif // wxUSE_DATEPICKCTRL_GENERIC #endif // wxUSE_DATEPICKCTRL