3 summary:: A container view that arranges its children vertically
5 related:: Classes/HLayoutView, Classes/CompositeView
10 In Qt GUI, this class has been rendered strong::obsolete:: by a special set of layout classes; they are easier to use and more flexible. See link::Classes/VLayout:: for an equivalent to this class, and link::Guides/GUI-Layout-Management:: for a general description of the Qt layout system.
13 VLayoutView can be a parent to other views, and it automatically arranges its child views in vertical order, expanding their width to its own bounds. Only the height of the children is relevant.
15 When arranging its children, VLayoutView takes the values of their 'minHeight' and 'maxHeight' properties into account. This is useful when a child's link::Classes/View#-resize#resize:: mode is set to 4, 5, or 6. See link::#examples:: below.
17 VLayoutView inherits some useful formatting methods from its superclasses.
20 VLayoutView is designed mainly for grouping and placing widgets. While you can set it to accept key presses, it does not accept mouse clicks or drags.
33 v = VLayoutView(w,Rect(10,10,300,300));
36 Slider(v,Rect(0,0,75,20)).value_(i / q)
42 // show the area of the view.
43 v.background_(Color.rand) // The sliders automatically expand to the optimal width
47 Stretching the layout view; Slider height is fixed:
54 v = VLayoutView(w,Rect(10,10,300,300));
55 v.background_(Color.rand);
56 v.resize = 5; // elastic
59 s = Slider(v,Rect(0,0,55,20));// The bounds.width are irrelevant here. They expand to the optimal width
63 StaticText(v, Rect(0,0,55,20)).background_(Color.rand).string_("Some Example Text").align_(\center);
68 Stretching the layout view and the contents; if all the contents are elastic, the heights of the contents are perfectly divided up. In this example, the StaticText is not elastic in order to preserve its height.
75 v = VLayoutView(w,Rect(10,10,300,300));
76 v.background_(Color.rand);
77 v.resize = 5; // elastic
80 s = Slider(v,Rect(0,0,75,20));
81 s.resize = 5; // elastic
85 StaticText(v, Rect(0,0,55,40))
86 .background_(Color.rand).string_("Some Example Text")
93 Mixed stretching modes:
99 v = VLayoutView(w,Rect(10,10,300,300));
100 v.resize = 5; // elastic
101 v.background_(Color.grey);
102 Array.fill(q,{ arg i;
104 s = Slider(v,Rect(0,0,75,20)).background_(Color.rand);
107 s.resize = 5; // some elastic
108 s.setProperty(\minHeight,20);
110 s.resize = 1; // some not elastic
114 StaticText(v, Rect(0,0,55,20)).background_(Color.rand).string_("Some Example Text").align_(\center);
120 Set minimum heights; beware that if the layout view height is smaller than the combined height of all the contents, things might disappear when you try to handle them with the mouse:
127 v = VLayoutView(w,Rect(10,10,300,300));
128 v.resize = 5; // elastic
129 v.background_(Color.grey);
130 Array.fill(q,{ arg i;
132 s = Slider(v,Rect(0,0,75,20)).background_(Color.blue.alpha_(0.2));
135 s.setProperty(\minHeight,20);
136 s.setProperty(\maxHeight,40);
150 v = VLayoutView(w,Rect(10,10,300,300));
151 v.setProperty(\spacing,0);
154 Slider(v,Rect(0,0,75,20))
162 Nesting: use VLayoutView and HLayoutView in combination:
166 w = Window.new("nesting",Rect(30,30,400,700));
168 v = VLayoutView(w,Rect(10,10,300,600));
170 v.background = Color.rand;
172 Array.fill(q,{ arg i;
173 Slider(v,Rect(0,0,75,20)).value_(i / q)
176 StaticText(v, Rect(0,0,55,20)).background_(Color.rand).string_("Some Example Text").align_(\center);
178 h = HLayoutView(v,Rect(10,10,300,300));
180 Array.fill(q,{ arg i;
181 Slider(h,Rect(0,0,20,70)).value_(i / q)
183 h.background = Color.rand;