blob: b2a9e1c3872805168bca68b951ea26862f5d5433 (
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
|
# 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 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()
|