blob: 402a652e0eea2705cf9c0ce5f8f77da8fd6d9841 (
plain)
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
|
# This example shows several controls of NiGui.
import nigui
app.init()
var window = newWindow()
var container = newLayoutContainer(Layout_Vertical)
window.add(container)
# Add a Button control:
var button = newButton("Button")
container.add(button)
# Add a Checkbox control:
var checkbox = newCheckbox("Checkbox")
container.add(checkbox)
# Add a Label control:
var label = newLabel("Label")
container.add(label)
# Add a Progress Bar control:
var progressBar = newProgressBar()
progressBar.value = 0.5
container.add(progressBar)
# Add a TextBox control:
var textBox = newTextBox("TextBox")
container.add(textBox)
# Add a TextArea control:
var textArea = newTextArea("TextArea\pLine 2\p")
container.add(textArea)
# Add more text to the TextArea:
for i in 3..15:
textArea.addLine("Line " & $i)
# Add click event to the button:
button.onClick = proc(event: ClickEvent) =
textArea.addLine("Button clicked")
window.show()
app.run()
|