-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathTimePickerCtrl.cpp
More file actions
30 lines (26 loc) · 980 Bytes
/
TimePickerCtrl.cpp
File metadata and controls
30 lines (26 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <wx/app.h>
#include <wx/dateevt.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/stattext.h>
#include <wx/timectrl.h>
namespace TimePickerCtrlExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "TimePickerCtrl example"} {
timePicker1->SetTime(12, 34, 56);
timePicker1->Bind(wxEVT_TIME_CHANGED, [&](wxDateEvent& event) {
staticText1->SetLabelText(timePicker1->GetValue().FormatTime());
});
staticText1->SetLabelText(timePicker1->GetValue().FormatTime());
}
private:
wxPanel* panel = new wxPanel {this};
wxTimePickerCtrl* timePicker1 = new wxTimePickerCtrl {panel, wxID_ANY, wxDefaultDateTime, {30, 30}};
wxStaticText* staticText1 = new wxStaticText {panel, wxID_ANY, wxEmptyString, {30, 70}};
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(TimePickerCtrlExample::Application);