-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathSpinCtrl.cpp
More file actions
28 lines (24 loc) · 831 Bytes
/
SpinCtrl.cpp
File metadata and controls
28 lines (24 loc) · 831 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
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/spinctrl.h>
#include <wx/stattext.h>
namespace SpinCtrlExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "SpinCtrl example"} {
spinCtrl1->SetValue(50);
spinCtrl1->Bind(wxEVT_SPINCTRL, [&](wxCommandEvent& event) {
text->SetLabel(wxString::Format("value = %d", spinCtrl1->GetValue()));
});
}
private:
wxPanel* panel = new wxPanel {this};
wxSpinCtrl* spinCtrl1 = new wxSpinCtrl {panel, 100, wxEmptyString, {80, 50}};
wxStaticText* text = new wxStaticText {panel, wxID_ANY, "value = 50", {80, 100}};
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(SpinCtrlExample::Application);