3 summary:: A container view that arranges its children horizontally
5 related:: Classes/VLayoutView, 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/HLayout:: for an equivalent to this class, and link::Guides/GUI-Layout-Management:: for a general description of the Qt layout system.
13 HLayoutView can be a parent to other views, and it automatically arranges its child views in horizontal order, expanding their height to its own bounds. Only the width of the children is relevant.
15 When arranging its children, HLayoutView takes the values of their 'minWidth' and 'maxWidth' properties into account. This is useful when a child's link::Classes/View#-resize#resize:: mode is set to 2, 5, or 8. See link::#examples:: below.
17 HLayoutView inherits some useful formatting methods from its superclasses.
20 HLayoutView 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.
28 Child view height fills the HLayoutView automatically:
35 h = HLayoutView(w,Rect(0,0,300,300));
38 Slider(h,Rect(0,0,20,75)).value_(i / q)
40 h.background_(Color.rand);
46 Stretching the layout view; Slider height fills the View automatically:
53 h = HLayoutView(w,Rect(0,0,300,300));
54 h.background = Color.rand;
55 h.resize = 5; // elastic
59 s = Slider(h,Rect(0,0,20,75)).background_(Color.grey.alpha_(0.4));
63 StaticText(h, Rect(0,0,105,20)).background_(Color.rand).string_(" Some Example\n Text");
68 Stretching the layout view and the contents; if all the contents are elastic, the widths of the contents are perfectly divided up. In this example, the StaticText is not elastic in order to preserve its width:
75 h = HLayoutView(w,Rect(0,0,300,300));
76 h.resize = 5; // elastic
77 h.background = Color.rand;
81 s = Slider(h,Rect(0,0,20,75));
82 s.resize = 5; // elastic
86 StaticText(h, Rect(0,0,105,20)).background_(Color.rand).string_(" Some Example\n Text");
92 Setting minWidth on contents; beware that if the layout view width is smaller than the combined width of all the contents, things might disappear when you try to handle them with the mouse:
99 h = HLayoutView(w,Rect(0,0,300,300));
100 h.background = Color.rand;
101 h.resize = 5; // elastic
103 Array.fill(q,{ arg i;
105 s = Slider(h,Rect(0,0,20,75));
108 s.resize = 5; // some elastic
109 s.setProperty(\minWidth,20);
111 s.resize = 1; // some not elastic
115 StaticText(h, Rect(0,0,105,20)).background_(Color.rand).string_(" Some Example\n Text");
126 h = HLayoutView(w,Rect(0,0,300,300));
127 h.resize = 5; // elastic
128 h.background = Color.rand;
129 Array.fill(q,{ arg i;
131 s = Slider(h,Rect(0,0,20,75));
134 s.setProperty(\minWidth,20);
135 s.setProperty(\maxWidth,40);
150 h = HLayoutView(w,Rect(0,0,300,300));
151 h.resize = 5; // elastic
153 Array.fill(q,{ arg i;
155 s = StaticText(h,120@20).string_("Some short text which wraps around");
158 s.setProperty(\minWidth,10);
159 s.setProperty(\maxWidth,120);
162 s.setProperty(\maxHeight,10);
163 s.setProperty(\minHeight,10);
165 s.background = Color.white;
180 h = HLayoutView(w,Rect(0,0,300,300));
181 h.setProperty(\spacing,0);
184 Slider(h,Rect(0,0,20,75))