summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrustable-code <krauter.simon@arcor.de>2019-03-21 19:20:55 +0100
committertrustable-code <krauter.simon@arcor.de>2019-03-21 19:20:55 +0100
commit8cb908dc9592f8d3dba7efe63dbca55a9ac3fc8d (patch)
tree329c6763ba39f20484e6d11b254b6514b40e630e
parentc4ed2fbec8b6dba6d80f49ef54c4112fed524bf6 (diff)
downloadNiGui-8cb908dc9592f8d3dba7efe63dbca55a9ac3fc8d.tar.gz
NiGui-8cb908dc9592f8d3dba7efe63dbca55a9ac3fc8d.zip
Add example_14_container_scrolling
-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()