-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.lua
74 lines (65 loc) · 2.81 KB
/
test.lua
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
#!/usr/bin/lua
local ui = require "lui"
local steps = true
ui.Init()
i = 0
ui.Timer(1000, function(i)
print(i, os.date())
return 1
end, i)
local spinbox, slider, progressbar
local function update(control)
local v = control:Value()
spinbox:Value(v)
slider:Value(v)
progressbar:Value(v)
end
spinbox = ui.NewSpinbox(0, 100):OnChanged(update)
slider = ui.NewSlider(0, 100):OnChanged(update)
progressbar = ui.NewProgressBar(0, 100)
local win = ui.NewWindow("Hello", 320, 200, false):Margined(true):SetChild(
ui.NewVerticalBox():Append(
ui.NewHorizontalBox():Append(
ui.NewGroup("Basic Controls"):Margined(true):SetChild(
ui.NewVerticalBox():Padded(true):Append(
ui.NewButton("Button"), ui.NewCheckbox("Checkbox"),
ui.NewLabel("Label"), ui.NewHorizontalSeparator(),
ui.NewDatePicker(), ui.NewDateTimePicker(),
ui.NewTimePicker())),
ui.NewVerticalBox():Append(
ui.NewGroup("Numbers"):Margined(true):SetChild(
ui.NewVerticalBox():Padded(true):Append(spinbox, slider,
progressbar)))
:Append(ui.NewGroup("Lists"):Margined(true):SetChild(
ui.NewVerticalBox():Padded(true):Append(
ui.NewCombobox():Append("Combobox Item 1",
"Combobox Item 2",
"Combobox Item 3"),
ui.NewEditableCombobox():Append(
"Editable Item 1", "Editable Item 2",
"Editable Item 3"),
ui.NewRadioButtons():Append("Radio Button 1",
"Radio Button 2",
"Radio Button 3"))
:Append(ui.NewTab():Append("Page 1",
ui.NewHorizontalBox(),
"Page 2",
ui.NewHorizontalBox(),
"Page 3",
ui.NewHorizontalBox()),
true)), true), true), true))
win:Show()
ui.QueueMain(function(a, b, c, d, e)
assert(a == 1)
assert(b == nil)
assert(c == 'a')
assert(d == true)
assert(e == nil)
print('QueueMain OK')
end, 1, nil, 'a', true)
if (not steps) then
ui.Main()
else
ui.MainSteps()
while ui.MainStep(true) do end
end