-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathPassword.cpp
More file actions
31 lines (27 loc) · 940 Bytes
/
Password.cpp
File metadata and controls
31 lines (27 loc) · 940 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
#include <string>
#include <FL/Fl.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <FL/fl_ask.H>
#include <FL/Fl_Window.H>
namespace Examples {
class Main_Window : public Fl_Window {
public:
Main_Window() : Fl_Window {200, 100, 300, 300, "Password example"} {
button_show_message.callback([](Fl_Widget* sender, void* data) {
auto window = reinterpret_cast<Main_Window*>(data);
auto result = fl_password("User password:", window->box_result.label());
if (result) window->box_result.copy_label(result);
}, this);
box_result.align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
}
private:
Fl_Button button_show_message {10, 10, 100, 25, "Password..."};
Fl_Box box_result {10, 50, 200, 25, "sysad47!74dasys"};
};
}
auto main(int argc, char *argv[]) -> int {
auto window = Examples::Main_Window {};
window.show(argc, argv);
return Fl::run();
}