forked from andlabs/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zy_page1_test.go
155 lines (140 loc) · 3.62 KB
/
zy_page1_test.go
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// 12 december 2015
package ui
var page1 *Box
func makePage1(w *Window) {
var xbutton *Button
page1 = newVerticalBox()
entry := NewEntry()
page1.Append(entry, false)
spaced := NewCheckbox("Spaced")
spaced.OnToggled(func(*Checkbox) {
setSpaced(spaced.Checked())
})
label := NewLabel("Label")
hbox := newHorizontalBox()
getButton := NewButton("Get Window Text")
getButton.OnClicked(func(*Button) {
entry.SetText(w.Title())
})
setButton := NewButton("Set Window Text")
setButton.OnClicked(func(*Button) {
w.SetTitle(entry.Text())
})
hbox.Append(getButton, true)
hbox.Append(setButton, true)
page1.Append(hbox, false)
hbox = newHorizontalBox()
getButton = NewButton("Get Button Text")
xbutton = getButton
getButton.OnClicked(func(*Button) {
entry.SetText(xbutton.Text())
})
setButton = NewButton("Set Button Text")
setButton.OnClicked(func(*Button) {
xbutton.SetText(entry.Text())
})
hbox.Append(getButton, true)
hbox.Append(setButton, true)
page1.Append(hbox, false)
hbox = newHorizontalBox()
getButton = NewButton("Get Checkbox Text")
getButton.OnClicked(func(*Button) {
entry.SetText(spaced.Text())
})
setButton = NewButton("Set Checkbox Text")
setButton.OnClicked(func(*Button) {
spaced.SetText(entry.Text())
})
hbox.Append(getButton, true)
hbox.Append(setButton, true)
page1.Append(hbox, false)
hbox = newHorizontalBox()
getButton = NewButton("Get Label Text")
getButton.OnClicked(func(*Button) {
entry.SetText(label.Text())
})
setButton = NewButton("Set Label Text")
setButton.OnClicked(func(*Button) {
label.SetText(entry.Text())
})
hbox.Append(getButton, true)
hbox.Append(setButton, true)
page1.Append(hbox, false)
hbox = newHorizontalBox()
getButton = NewButton("Get Group Text")
getButton.OnClicked(func(*Button) {
entry.SetText(page2group.Title())
})
setButton = NewButton("Set Group Text")
setButton.OnClicked(func(*Button) {
page2group.SetTitle(entry.Text())
})
hbox.Append(getButton, true)
hbox.Append(setButton, true)
page1.Append(hbox, false)
hbox = newHorizontalBox()
hbox.Append(spaced, true)
getButton = NewButton("On")
getButton.OnClicked(func(*Button) {
spaced.SetChecked(true)
})
hbox.Append(getButton, false)
getButton = NewButton("Off")
getButton.OnClicked(func(*Button) {
spaced.SetChecked(false)
})
hbox.Append(getButton, false)
getButton = NewButton("Show")
getButton.OnClicked(func(*Button) {
// TODO
})
hbox.Append(getButton, false)
page1.Append(hbox, false)
testBox := newHorizontalBox()
ybutton := NewButton("Button")
testBox.Append(ybutton, true)
getButton = NewButton("Show")
getButton.OnClicked(func(*Button) {
ybutton.Show()
})
testBox.Append(getButton, false)
getButton = NewButton("Hide")
getButton.OnClicked(func(*Button) {
ybutton.Hide()
})
testBox.Append(getButton, false)
getButton = NewButton("Enable")
getButton.OnClicked(func(*Button) {
ybutton.Enable()
})
testBox.Append(getButton, false)
getButton = NewButton("Disable")
getButton.OnClicked(func(*Button) {
ybutton.Disable()
})
testBox.Append(getButton, false)
page1.Append(testBox, false)
hbox = newHorizontalBox()
getButton = NewButton("Show")
getButton.OnClicked(func(*Button) {
testBox.Show()
})
hbox.Append(getButton, false)
getButton = NewButton("Hide")
getButton.OnClicked(func(*Button) {
testBox.Hide()
})
hbox.Append(getButton, false)
getButton = NewButton("Enable")
getButton.OnClicked(func(*Button) {
testBox.Enable()
})
hbox.Append(getButton, false)
getButton = NewButton("Disable")
getButton.OnClicked(func(*Button) {
testBox.Disable()
})
hbox.Append(getButton, false)
page1.Append(hbox, false)
page1.Append(label, false)
}