From 8cb908dc9592f8d3dba7efe63dbca55a9ac3fc8d Mon Sep 17 00:00:00 2001 From: trustable-code Date: Thu, 21 Mar 2019 19:20:55 +0100 Subject: Add example_14_container_scrolling --- examples/example_14_container_scrolling.nim | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 examples/example_14_container_scrolling.nim (limited to 'examples') 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() -- cgit v1.2.3