1 module widgets.scroll;
2
3 import dlangui;
4
5 class ScrollExample : ScrollWidget
6 {
7 this(string ID)
8 {
9 super(ID);
10
11 layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
12 WidgetGroup scrollContent = new VerticalLayout("CONTENT");
13 scrollContent.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
14
15 TableLayout table2 = new TableLayout("TABLE2");
16 table2.colCount = 2;
17 // headers
18 table2.addChild((new TextWidget(null, "Parameter Name"d)).alignment(Align.Right | Align.VCenter));
19 table2.addChild((new TextWidget(null, "Edit Box to edit parameter"d)).alignment(Align.Left | Align.VCenter));
20 // row 1
21 table2.addChild((new TextWidget(null, "Parameter 1 name"d)).alignment(Align.Right | Align.VCenter));
22 table2.addChild((new EditLine("edit1", "Text 1"d)).layoutWidth(FILL_PARENT));
23 // row 2
24 table2.addChild((new TextWidget(null, "Parameter 2 name bla bla"d)).alignment(Align.Right | Align.VCenter));
25 table2.addChild((new EditLine("edit2", "Some text for parameter 2 blah blah blah"d)).layoutWidth(FILL_PARENT));
26 // row 3
27 table2.addChild((new TextWidget(null, "Param 3"d)).alignment(Align.Right | Align.VCenter));
28 table2.addChild((new EditLine("edit3", "Parameter 3 value"d)).layoutWidth(FILL_PARENT));
29 // row 4
30 table2.addChild((new TextWidget(null, "Param 4"d)).alignment(Align.Right | Align.VCenter));
31 table2.addChild((new EditLine("edit3", "Parameter 4 value shdjksdfh hsjdfas hdjkf hdjsfk ah"d)).layoutWidth(FILL_PARENT));
32 // row 5
33 table2.addChild((new TextWidget(null, "Param 5 - edit text here - blah blah blah"d)).alignment(Align.Right | Align.VCenter));
34 table2.addChild((new EditLine("edit3", "Parameter 5 value"d)).layoutWidth(FILL_PARENT));
35 // row 6
36 table2.addChild((new TextWidget(null, "Param 6 - just to fill content widget (DISABLED)"d)).alignment(Align.Right | Align.VCenter).enabled(false));
37 table2.addChild((new EditLine("edit3", "Parameter 5 value"d)).layoutWidth(FILL_PARENT).enabled(false));
38 // row 7
39 table2.addChild((new TextWidget(null, "Param 7 - just to fill content widget (DISABLED)"d)).alignment(Align.Right | Align.VCenter).enabled(false));
40 table2.addChild((new EditLine("edit3", "Parameter 5 value"d)).layoutWidth(FILL_PARENT).enabled(false));
41 // row 8
42 table2.addChild((new TextWidget(null, "Param 8 - just to fill content widget"d)).alignment(Align.Right | Align.VCenter));
43 table2.addChild((new EditLine("edit3", "Parameter 5 value"d)).layoutWidth(FILL_PARENT));
44 table2.margins(Rect(10,10,10,10)).layoutWidth(FILL_PARENT);
45 scrollContent.addChild(table2);
46
47 scrollContent.addChild(new TextWidget(null, "Now - some buttons"d));
48 scrollContent.addChild(new ImageTextButton("btn1", "fileclose", "Close"d));
49 scrollContent.addChild(new ImageTextButton("btn2", "fileopen", "Open"d));
50 scrollContent.addChild(new TextWidget(null, "And checkboxes"d));
51 scrollContent.addChild(new CheckBox("btn1", "CheckBox 1"d));
52 scrollContent.addChild(new CheckBox("btn2", "CheckBox 2"d));
53
54 contentWidget = scrollContent;
55 }
56 }