-
Notifications
You must be signed in to change notification settings - Fork 24
/
place_login.cpp
43 lines (31 loc) · 1.36 KB
/
place_login.cpp
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
33
34
35
36
37
38
39
40
41
42
43
#include <nana/gui.hpp>
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/gui/widgets/textbox.hpp>
int main()
{
using namespace nana;
// Define widgets
form fm;
textbox usr {fm},
pswd {fm};
button login {fm, "Login"},
cancel{fm, "Cancel"};
usr .tip_string("User:" ).multi_lines(false);
pswd.tip_string("Password:").multi_lines(false).mask('*');
// Define a place for the form.
place plc {fm};
// Divide the form into fields
//plc.div("margin= 10% gap=20 vertical< weight=70 gap=20 vertical textboxs arrange=[25,25]> <min=20> <weight=25 gap=10 buttons> > ");
plc.div("<><weight=80% vertical<><weight=70% vertical <vertical gap=10 textboxs arrange=[25,25]> <weight=25 gap=10 buttons> ><>><>");
//Insert widgets
//The field textboxs is vertical, it automatically adjusts the widgets' top and height.
plc.field("textboxs")<< usr << pswd ;
plc.field("buttons") <<login << cancel;
// Finially, the widgets should be collocated.
// Do not miss this line, otherwise the widgets are not collocated
// until the form is resized.
plc.collocate();
fm.show();
exec();
}