]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datectlg.cpp
10.2 fix for CG
[wxWidgets.git] / src / generic / datectlg.cpp
index bbd2f8f0d1f946aca8c4f8da47f77eba434eb38c..3ccd9d0553621f24266fd2ff34252ac31d56c142 100644 (file)
@@ -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);