blob: 157ca5365fc70a356107d3e3fdcd636df19d07b0 (
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
|
# This example shows an inner container with a scrollbar.
# Result:
# topContainer will take as many space as needed for the 5 labels.
# scrollContainer takes the remaining space.
# There is only one scrollbar:
# The vertical scrollbar in scrollContainer, because it's height is insufficient for the 25 labels.
# When the window height is increased, the scrollbar disappears.
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.heightMode = HeightMode_Expand
scrollContainer.widthMode = WidthMode_Expand
for i in 1..25:
scrollContainer.add(newLabel("Label in scrollContainer #" & $i))
window.show()
app.run()
|