git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42207
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
protected:
virtual wxSize DoGetBestSize() const;
protected:
virtual wxSize DoGetBestSize() const;
+ // the date currently shown by the control, may be invalid
+ wxDateTime m_date;
+
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
};
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl)
};
{
wxLogDebug(_T("DateTime_SetSystemtime() failed"));
}
{
wxLogDebug(_T("DateTime_SetSystemtime() failed"));
}
}
wxDateTime wxDatePickerCtrl::GetValue() const
{
}
wxDateTime wxDatePickerCtrl::GetValue() const
{
wxDateTime dt;
SYSTEMTIME st;
if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
wxDateTime dt;
SYSTEMTIME st;
if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
wxFromSystemTime(&dt, st);
}
wxFromSystemTime(&dt, st);
}
+ wxASSERT_MSG( m_date.IsValid() == dt.IsValid() &&
+ (!dt.IsValid() || dt == m_date),
+ _T("bug in wxDatePickerCtrl: m_date not in sync") );
+#endif // __WXDEBUG__
+
+ return m_date;
}
void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
}
void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
if ( dtch->dwFlags == GDT_VALID )
wxFromSystemTime(&dt, dtch->st);
if ( dtch->dwFlags == GDT_VALID )
wxFromSystemTime(&dt, dtch->st);
- wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
- if ( GetEventHandler()->ProcessEvent(event) )
+ // filter out duplicate DTN_DATETIMECHANGE events which the native
+ // control sends us when using wxDP_DROPDOWN style
+ if ( !m_date.IsValid() || dt != m_date )
- *result = 0;
- return true;
+ m_date = dt;
+ wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
+ if ( GetEventHandler()->ProcessEvent(event) )
+ {
+ *result = 0;
+ return true;
+ }