git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31989
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxSizer *sizerText = new wxBoxSizer(wxHORIZONTAL);
sizerText->Add(new wxStaticText(this, -1, _T("Date in ISO format: ")),
wxSizer *sizerText = new wxBoxSizer(wxHORIZONTAL);
sizerText->Add(new wxStaticText(this, -1, _T("Date in ISO format: ")),
- wxSizerFlags().Border());
+ wxSizerFlags().Border().Align(wxALIGN_CENTRE_VERTICAL));
m_text = new wxTextCtrl(this, -1);
m_text = new wxTextCtrl(this, -1);
- sizerText->Add(m_text, wxSizerFlags().Expand().Border());
+ sizerText->Add(m_text, wxSizerFlags().
+ Expand().Border().Align(wxALIGN_CENTRE_VERTICAL));
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(new wxStaticText
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(new wxStaticText
void MyDialog::OnDateChange(wxDateEvent& event)
{
void MyDialog::OnDateChange(wxDateEvent& event)
{
- m_text->SetValue(event.GetDate().FormatISODate());
+ const wxDateTime dt = event.GetDate();
+ m_text->SetValue(dt.IsValid()? dt.FormatISODate() : wxString());
}
#endif // wxUSE_DATEPICKCTRL
}
#endif // wxUSE_DATEPICKCTRL