Merge r53510 from 2.8 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
eeb6bb3493
commit
d6781628fd
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user