summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/example_14_container_scrolling.nim33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/example_14_container_scrolling.nim b/examples/example_14_container_scrolling.nim
new file mode 100755
index 0000000..95923d0
--- /dev/null
+++ b/examples/example_14_container_scrolling.nim
@@ -0,0 +1,33 @@
+# This example shows an inner container with a scrollbar.
+# Result:
+# topContainer will take as many space as needed for the 5 labels.
+# There is only one scrollbar:
+# The vertical scrollbar in scrollContainer, because it has an insufficient fixed height.
+
+import NiGui
+
+app.init()
+
+var window = newWindow()
+window.width = 800
+window.height = 500
+
+var mainContainer = newLayoutContainer(Layout_Vertical)
+window.add(mainContainer)
+
+var topContainer = newLayoutContainer(Layout_Vertical)
+mainContainer.add(topContainer)
+
+for i in 1..5:
+ topContainer.add(newLabel("Label in topContainer #" & $i))
+
+var scrollContainer = newLayoutContainer(Layout_Vertical)
+mainContainer.add(scrollContainer)
+scrollContainer.height = 300
+scrollContainer.widthMode = WidthMode_Expand
+
+for i in 1..25:
+ scrollContainer.add(newLabel("Label in scrollContainer #" & $i))
+
+window.show()
+app.run()