From 2436cac7772915acbf15c28f3a7f87857bf9f892 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Feb 2005 13:07:20 +0000 Subject: [PATCH] fixes for wxDP_ALLOWNONE handling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datectlg.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index bbd2f8f0d1..3ccd9d0553 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -582,19 +582,17 @@ void wxDatePickerCtrlGeneric::OnKillFocus(wxFocusEvent &ev) wxDateTime dt; dt.ParseFormat(m_txt->GetValue(), m_format); - if (!dt.IsValid()) + if ( !dt.IsValid() ) { if ( !HasFlag(wxDP_ALLOWNONE) ) dt = m_currentDate; } - if (!dt.IsValid()) - m_txt->SetValue(wxEmptyString); - else - m_txt->SetValue(dt.Format(m_format)); + m_txt->SetValue(dt.IsValid()? dt.Format(m_format) : wxString()); // notify that we had to change the date after validation - if (m_currentDate != dt) + if ( (dt.IsValid() && m_currentDate != dt) || + (!dt.IsValid() && m_currentDate.IsValid()) ) { m_currentDate = dt; wxDateEvent event(this, dt, wxEVT_DATE_CHANGED); -- 2.45.2