From: Robin Dunn Date: Fri, 9 May 2008 22:18:34 +0000 (+0000) Subject: Merge r53510 from 2.8 branch X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d6781628fda216a01fa99ae3e49805b1a98b6ef2 Merge r53510 from 2.8 branch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index c451b17347..8c6178d01d 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -154,6 +154,7 @@ public: if ( date.IsValid() ) { m_combo->SetText(date.Format(m_format)); + SetDate(date); } else // invalid date { @@ -162,8 +163,6 @@ public: m_combo->SetText(wxEmptyString); } - - SetDate(date); } bool ParseDateTime(const wxString& s, wxDateTime* pDt) @@ -230,6 +229,9 @@ private: m_combo->SetText(GetStringValueFor(dt)); + if ( !dt.IsValid() && HasDPFlag(wxDP_ALLOWNONE) ) + return; + // notify that we had to change the date after validation if ( (dt.IsValid() && (!dtOld.IsValid() || dt != dtOld)) || (!dt.IsValid() && dtOld.IsValid()) ) @@ -314,11 +316,9 @@ private: virtual void SetStringValue(const wxString& s) { wxDateTime dt; - if ( ParseDateTime(s, &dt) ) + if ( !s.empty() && ParseDateTime(s, &dt) ) SetDate(dt); - else if ( HasDPFlag(wxDP_ALLOWNONE) ) - SetDate(wxInvalidDateTime); - //else: !wxDP_ALLOWNONE, keep the old value + //else: keep the old value } virtual wxString GetStringValue() const