X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eaf6274cc01dec5faebd88d9cd06c17a462d32c5..9d180f3ad0459709707ca591295c7c885d09c614:/src/generic/calctrl.cpp diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 084b32340b..64d9ec719c 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -68,7 +68,11 @@ class wxYearSpinCtrl : public wxSpinCtrl public: wxYearSpinCtrl(wxCalendarCtrl *cal); - void OnYearTextChange(wxCommandEvent& event) { m_cal->OnYearChange(event); } + void OnYearTextChange(wxCommandEvent& event) + { + m_cal->SetUserChangedYear(); + m_cal->OnYearChange(event); + } void OnYearChange(wxSpinEvent& event) { m_cal->OnYearChange(event); } private: @@ -175,6 +179,8 @@ void wxCalendarCtrl::Init() { m_comboMonth = NULL; m_spinYear = NULL; + m_staticYear = NULL; + m_staticMonth = NULL; m_userChangedYear = FALSE; @@ -449,8 +455,6 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& date) { if ( !m_userChangedYear ) m_spinYear->SetValue(m_date.Format(_T("%Y"))); - else // don't overwrite what the user typed in - m_userChangedYear = FALSE; } } @@ -468,6 +472,8 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& date) } } + m_userChangedYear = FALSE; + return retval; } @@ -1569,10 +1575,6 @@ void wxCalendarCtrl::OnYearChange(wxCommandEvent& event) return; } - // set the flag for SetDate(): otherwise it would overwrite the year - // typed in by the user - m_userChangedYear = TRUE; - wxDateTime::Tm tm = m_date.GetTm(); if ( tm.mday > wxDateTime::GetNumberOfDays(tm.mon, year) )