X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/59a2c19914f02be7eae4ec8b7c58b06c19995146..14619f10b0bdb630206607abd0ce0319d45e095a:/samples/widgets/timepick.cpp diff --git a/samples/widgets/timepick.cpp b/samples/widgets/timepick.cpp index 9100980e35..a919d826e6 100644 --- a/samples/widgets/timepick.cpp +++ b/samples/widgets/timepick.cpp @@ -28,6 +28,7 @@ // for all others, include the necessary headers #ifndef WX_PRECOMP + #include "wx/crt.h" #include "wx/app.h" #include "wx/log.h" @@ -217,21 +218,23 @@ void TimePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void TimePickerWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event)) { - wxDateTime dt; - if ( !dt.ParseISOTime(m_textCur->GetValue()) ) + int h, m, s; + if ( wxSscanf(m_textCur->GetValue(), "%d:%d:%d", &h, &m, &s) != 3 ) { wxLogError("Invalid time, please use HH:MM:SS format."); return; } - m_timePicker->SetValue(dt); + m_timePicker->SetTime(h, m, s); } void TimePickerWidgetsPage::OnTimeChanged(wxDateEvent& event) { - wxLogMessage("Time changed, now is %s (control value is %s).", - event.GetDate().FormatISOTime(), - m_timePicker->GetValue().FormatISOTime()); + int h, m, s; + m_timePicker->GetTime(&h, &m, &s); + + wxLogMessage("Time changed, now is %s (control value is %02d:%02d:%02d).", + event.GetDate().FormatISOTime(), h, m, s); } #endif // wxUSE_TIMEPICKCTRL