summaryrefslogtreecommitdiff
path: root/examples/example_13_fixed_layout.nim
blob: b879d48d0a67ec9adc74a05cbcd8da372c9f3b64 (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
# This example shows how to have controls in a fixed position.
# This means that NiGui's automatic layout capabilities are not used and the controls have to be placed manually.

import nigui

app.init()

var window = newWindow()

var container = newContainer()
window.add(container)

# Add a Button control:
var button = newButton("Button at 0,0")
container.add(button)
button.x = 0
button.y = 0
button.width = 200
button.height = 50

# Add another button:
button = newButton("Button at 300,0")
container.add(button)
button.x = 300
button.y = 0
button.width = 200
button.height = 50

# Add another button:
button = newButton("Button at 0,100")
container.add(button)
button.x = 0
button.y = 100
button.width = 200
button.height = 50

window.show()

app.run()