-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathInput.cpp
More file actions
32 lines (28 loc) · 990 Bytes
/
Input.cpp
File metadata and controls
32 lines (28 loc) · 990 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
31
32
#include <FL/Fl.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Window.H>
namespace Examples {
class Main_Window : public Fl_Window {
public:
Main_Window() : Fl_Window {200, 100, 300, 300, "Input example"} {
input1.value("input text");
input1.when(FL_WHEN_CHANGED);
input1.callback([](Fl_Widget* sender, void* window) {
reinterpret_cast<Main_Window*>(window)->input2.value(reinterpret_cast<Main_Window*>(window)->input1.value());
}, this);
input2.value("input text");
input2.when(FL_WHEN_CHANGED);
input2.callback([](Fl_Widget* sender, void* window) {
reinterpret_cast<Main_Window*>(window)->input1.value(reinterpret_cast<Main_Window*>(window)->input2.value());
}, this);
}
private:
Fl_Input input1 {10, 10, 100, 25};
Fl_Input input2 {10, 50, 100, 25};
};
}
auto main(int argc, char *argv[]) -> int {
auto window = Examples::Main_Window {};
window.show(argc, argv);
return Fl::run();
}