summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authortrustable-code <krauter.simon@arcor.de>2019-02-05 19:34:14 +0100
committertrustable-code <krauter.simon@arcor.de>2019-02-05 19:34:14 +0100
commitf85aea6bf61f6b214994687f5df10496aadf724e (patch)
tree3b2742fa79e337430b4eb783bf5c056ce74d6766 /examples
parent3d1ecd992a24a935f68947ab4641968033eb06bb (diff)
downloadNiGui-f85aea6bf61f6b214994687f5df10496aadf724e.tar.gz
NiGui-f85aea6bf61f6b214994687f5df10496aadf724e.zip
Add fixed layout example
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/example_13_fixed_layout.nim39
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/example_13_fixed_layout.nim b/examples/example_13_fixed_layout.nim
new file mode 100755
index 0000000..b879d48
--- /dev/null
+++ b/examples/example_13_fixed_layout.nim
@@ -0,0 +1,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()