1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.46">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #001ee6}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0018b8}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; min-height: 12.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; min-height: 14.0px}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica
; min-height: 17.0px}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #a41c14}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
26 span
.s1
{font: 18.0px Helvetica
}
27 span
.s2
{color: #000000}
28 span
.s3
{color: #0018b8}
29 span
.s4
{text-decoration: underline
; color: #001ee6}
30 span
.s5
{text-decoration: underline
}
31 span
.s6
{font: 9.0px Monaco
}
32 span
.s7
{color: #a41c14}
33 span
.s8
{color: #356f14}
34 span
.s9
{color: #606060}
35 span
.s10
{font: 11.0px Monaco
}
36 span
.Apple-tab-span
{white-space:pre
}
40 <p class=
"p1"><span class=
"s1"><b>SCCompositeView
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>A view that contains other views
</b><span class=
"s1"><b><span class=
"Apple-tab-span"> </span></b></span></p>
41 <p class=
"p2"><br></p>
42 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><b>Object
</b></a><b> :
</b><a href=
"SCView.html"><b>SCView
</b></a><b> :
</b><a href=
"SCContainerView.html"><b>SCContainerView
</b></a></span></p>
43 <p class=
"p4"><br></p>
44 <p class=
"p1">A container for grouping other views and widgets. SCCompositeView inherits all of its methods from
<a href=
"SCContainerView.html"><span class=
"s3">SCContainerView
</span></a><span class=
"s3">.
</span></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p5"><span class=
"s2"><b>See also:
</b> <a href=
"../../Libraries/crucial/Gui/FlowView.html"><span class=
"s4">FlowView
</span></a></span>,
<a href=
"../GUI-Tools/FlowLayout.html"><span class=
"s5">FlowLayout
</span></a></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p6"><b>Some Important Issues Regarding SCCompositeView
</b></p>
49 <p class=
"p2"><br></p>
50 <p class=
"p1">SCCompositeView is used for grouping widgets in a window. While it accepts key actions, it does not accept mouse clicks or drags.
</p>
51 <p class=
"p2"><br></p>
52 <p class=
"p6"><b>Creation / Class Methods
</b></p>
53 <p class=
"p7"><br></p>
54 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*new (parent, bounds)
</b></p>
55 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b></p>
56 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>parent
</b>- The parent view.
</p>
57 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>bounds
</b>- An instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s3">Rect
</span></a>, or a
<a href=
"../../Geometry/Point.html"><span class=
"s3">Point
</span></a> indicating width@height.
</p>
58 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
59 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
60 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s3">Window
</span>.new;
</p>
61 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
62 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c =
<span class=
"s3">CompositeView
</span>(w,
<span class=
"s3">Rect
</span>(
0,
0,
300,
300) );
</p>
63 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
64 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
<span class=
"s3">Slider2D
</span>(c,
<span class=
"s3">Rect
</span>(
10,
10,
100,
100) );
<span class=
"Apple-tab-span"> </span></p>
65 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">Slider2D
</span>(c,
<span class=
"s3">Rect
</span>(
110,
110,
100,
100) );
</p>
66 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
67 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
68 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
69 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
70 <p class=
"p7"><br></p>
71 <p class=
"p13"><b>Coordinate System
</b></p>
72 <p class=
"p14"><br></p>
73 <p class=
"p8">Containers use relative coordinates, i.e.
<span class=
"Apple-converted-space"> </span>views are placed relative to the upper left corner of the container.
</p>
74 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
75 <p class=
"p12"><span class=
"Apple-tab-span"> </span>(
</p>
76 <p class=
"p12"><span class=
"Apple-tab-span"> </span>w =
<span class=
"s3">Window
</span>.new;
</p>
77 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
78 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c =
<span class=
"s3">CompositeView
</span>(w,
<span class=
"s3">Rect
</span>(
50,
0,
300,
300));
</p>
79 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span>a =
</span><span class=
"s3">Slider2D
</span><span class=
"s2">(c,
</span><span class=
"s3">Rect
</span><span class=
"s2">(
0,
0,
100,
100));
<span class=
"Apple-tab-span"> </span></span>// actually displays at (
50,
0)
</p>
80 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">Slider2D
</span>(c,
<span class=
"s3">Rect
</span>(
100,
100,
100,
100));
</p>
81 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
82 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c.background =
<span class=
"s3">Color
</span>.rand;
</p>
83 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
84 <p class=
"p12"><span class=
"Apple-tab-span"> </span>w.front;
</p>
85 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
86 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
87 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span>c.bounds_(
</span><span class=
"s3">Rect
</span><span class=
"s2">(
100,
0,
300,
300));
</span>// contents adust since coords are relative
</p>
88 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span>c.resize_(
6);
</span>// contents adust since coords are relative
</p>
89 <p class=
"p2"><br></p>
90 <p class=
"p13"><b>Keydown Bubbling
</b></p>
91 <p class=
"p14"><br></p>
92 <p class=
"p1">Key actions
"bubble up" to the parent view if a view does not define one itself. In the following example, a and b do not have keyDown actions themselves, so the key event is passed to c, the parent, which defines the key down action. d's parent is the SCTopView, which has no key down action. See also
<a href=
"SCView.html"><span class=
"s3">SCView
</span></a>.
</p>
93 <p class=
"p2"><br></p>
94 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span>(
</span>//Click on the different views and hit keys on the keyboard.
</p>
95 <p class=
"p4"><br></p>
96 <p class=
"p12"><span class=
"Apple-tab-span"> </span>w =
<span class=
"s3">Window
</span>.new;
</p>
97 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
98 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c =
<span class=
"s3">CompositeView
</span>(w,
<span class=
"s3">Rect
</span>(
0,
0,
200,
200)).background_(
<span class=
"s3">Color
</span>.grey.alpha_(
0.3));
</p>
99 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
100 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s3">Slider2D
</span>(c,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
<span class=
"Apple-tab-span"> </span></p>
101 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">Slider2D
</span>(c,
<span class=
"s3">Rect
</span>(
100,
100,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
102 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
103 <p class=
"p12"><span class=
"Apple-tab-span"> </span>w.front;
</p>
104 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
105 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c.keyDownAction = {
</p>
106 <p class=
"p16"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"keydown bubbled up to c"<span class=
"s2">.postln;
</span></p>
107 <p class=
"p12"><span class=
"Apple-tab-span"> </span>};
</p>
108 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
109 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>//d is on window w, not on composite view c
</p>
110 <p class=
"p12"><span class=
"Apple-tab-span"> </span>d =
<span class=
"s3">Slider2D
</span>(w,
<span class=
"s3">Rect
</span>(
200,
200,
100,
100));
</p>
111 <p class=
"p12"><span class=
"Apple-tab-span"> </span>d.background =
<span class=
"s3">Color
</span>.black;
</p>
112 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
113 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
114 <p class=
"p2"><br></p>
115 <p class=
"p13"><b>Decorators
</b></p>
116 <p class=
"p14"><br></p>
117 <p class=
"p1">A 'decorator' object can be set to handle layout management. All views added to the CompositeView will now be placed by the decorator. Currently the only one existing is
<a href=
"../GUI-Tools/FlowLayout.html"><span class=
"s3">FlowLayout
</span></a>. You can use the addFlowLayout method as a short cut to assigning FlowLayout to decorator.
</p>
118 <p class=
"p4"><br></p>
119 <p class=
"p12"><span class=
"Apple-tab-span"> </span>(
</p>
120 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s3">Window
</span>.new;
</p>
121 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
122 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">CompositeView
</span>(a,
<span class=
"s3">Rect
</span>(
0,
0,
500,
500));
</p>
123 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b.decorator =
<span class=
"s3">FlowLayout
</span>(b.bounds);
</p>
124 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// b.addFlowLayout; // you can also write this for convenience
</p>
125 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
126 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// adding views to b automatically use the decorator
</p>
127 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// no need to use parent.decorator.place
</p>
128 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c =
<span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100));
<span class=
"Apple-tab-span"> </span><span class=
"s7">// size matters
</span></p>
129 <p class=
"p12"><span class=
"Apple-tab-span"> </span>d =
<span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100));
<span class=
"s7">// origin doesn't
</span></p>
130 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
131 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a.front;
</p>
132 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
133 <p class=
"p2"><br></p>
134 <p class=
"p1">You can also use an empty composite view nicely as a spacer in
<a href=
"SCVLayoutView.html"><span class=
"s3">VLayoutView
</span></a>,
<a href=
"SCHLayoutView.html"><span class=
"s3">HLayoutView
</span></a>, or views that have a
<a href=
"../GUI-Tools/FlowLayout.html"><span class=
"s3">FlowLayout
</span></a> as their decorator.
</p>
135 <p class=
"p2"><br></p>
136 <p class=
"p12"><span class=
"Apple-tab-span"> </span>(
</p>
137 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s3">Window
</span>.new;
</p>
138 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
139 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">CompositeView
</span>(a,
<span class=
"s3">Rect
</span>(
0,
0,
500,
500));
</p>
140 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b.decorator =
<span class=
"s3">FlowLayout
</span>(
<span class=
"s3">Rect
</span>(
0,
0,
500,
500));
</p>
141 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
<span class=
"Apple-tab-span"> </span></p>
142 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span><span class=
"s3">CompositeView
</span><span class=
"s2">(b,
</span><span class=
"s3">Rect
</span><span class=
"s2">(
0,
0,
70,
100));
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//just used for spacing
</p>
143 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
144 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
145 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b.decorator.nextLine;
</p>
146 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
147 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
<span class=
"Apple-tab-span"> </span></p>
148 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span><span class=
"s3">CompositeView
</span><span class=
"s2">(b,
</span><span class=
"s3">Rect
</span><span class=
"s2">(
0,
0,
70,
100))
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>;
</span>//just used for spacing
</p>
149 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">Slider2D
</span>(b,
<span class=
"s3">Rect
</span>(
0,
0,
100,
100)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
150 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
151 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a.front;
</p>
152 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
153 <p class=
"p2"><br></p>
154 <p class=
"p2"><br></p>
155 <p class=
"p13"><b>Hiding / Swapping
</b></p>
156 <p class=
"p14"><br></p>
157 <p class=
"p1">You can stack CompositeViews on top of each other and use a button show only one of them
</p>
158 <p class=
"p2"><br></p>
159 <p class=
"p12"><span class=
"Apple-tab-span"> </span>(
</p>
160 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> colors = [
<span class=
"s3">Color
</span>.blue,
<span class=
"s3">Color
</span>.red,
<span class=
"s3">Color
</span>.green];
</p>
161 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s3">Window
</span>.new;
</p>
162 <p class=
"p12"><span class=
"Apple-tab-span"> </span>q =
3;
</p>
163 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
164 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">Button
</span>(a,
<span class=
"s3">Rect
</span>(
0,
0,
160,
20));
</p>
165 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
166 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b.states =
<span class=
"s3">Array
</span>.fill(q,{
<span class=
"s3">arg
</span> i;
</p>
167 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[i.asString,
<span class=
"s3">Color
</span>.white,colors.wrapAt(i)]
</p>
168 <p class=
"p12"><span class=
"Apple-tab-span"> </span>});
</p>
169 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
170 <p class=
"p12"><span class=
"Apple-tab-span"> </span>b.action = {
<span class=
"s3">arg
</span> butt;
</p>
171 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>p.visible =
<span class=
"s3">false
</span>;
</p>
172 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>p = c.at(butt.value);
</p>
173 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>p.visible =
<span class=
"s3">true
</span>;
</p>
174 <p class=
"p12"><span class=
"Apple-tab-span"> </span>};
</p>
175 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
176 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c =
<span class=
"s3">Array
</span>.fill(q,{
<span class=
"s3">arg
</span> i;
</p>
177 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b =
<span class=
"s3">CompositeView
</span>(a,
<span class=
"s3">Rect
</span>(
0,
25,
300,
300));
</p>
178 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b.background=colors[i].alpha_(
0.2);
</p>
179 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b.visible=
<span class=
"s3">false
</span>;
</p>
180 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b;
</p>
181 <p class=
"p12"><span class=
"Apple-tab-span"> </span>});
</p>
182 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
183 <p class=
"p12"><span class=
"Apple-tab-span"> </span>5.do{
<span class=
"s3">arg
</span> i;c[
0].add(
<span class=
"s3">Slider
</span>(c[
0],
<span class=
"s3">Rect
</span>(
10,i*
30+
10,
150,
25)).value_(
1.0.rand))};
</p>
184 <p class=
"p12"><span class=
"Apple-tab-span"> </span>5.do{
<span class=
"s3">arg
</span> i;c[
1].add(
<span class=
"s3">Slider
</span>(c[
1],
<span class=
"s3">Rect
</span>(i*
30+
10,
10,
25,
150)).value_(
1.0.rand))};
</p>
185 <p class=
"p12"><span class=
"Apple-tab-span"> </span>c[
2].add(
<span class=
"s3">Slider2D
</span>(c[
2],
<span class=
"s3">Rect
</span>(
10,
10,
155,
150)).x_(
1.0.rand).y_(
1.0.rand));
</p>
186 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
187 <p class=
"p12"><span class=
"Apple-tab-span"> </span>p = c.at(
0);
<span class=
"s7">// previous
</span></p>
188 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span>p.visible =
</span><span class=
"s3">true
</span><span class=
"s2">;
</span>// show first one
</p>
189 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
190 <p class=
"p12"><span class=
"Apple-tab-span"> </span>a.front;
</p>
191 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
192 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
193 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
194 <p class=
"p13"><b>Nested Example
</b></p>
195 <p class=
"p14"><br></p>
196 <p class=
"p1">In this example, the StaticText accepts mouse clicks, since container views can't:
</p>
197 <p class=
"p14"><br></p>
198 <p class=
"p12"><span class=
"Apple-tab-span"> </span>(
</p>
199 <p class=
"p12"><span class=
"Apple-tab-span"> </span>w=
<span class=
"s3">Window
</span>.new.front;
</p>
200 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
201 <p class=
"p12"><span class=
"Apple-tab-span"> </span>v=
<span class=
"s3">CompositeView
</span>.new(w,w.view.bounds.insetBy(
10)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
202 <p class=
"p12"><span class=
"Apple-tab-span"> </span>v.decorator=
<span class=
"s3">FlowLayout
</span>(v.bounds);
</p>
203 <p class=
"p16"><span class=
"s2"><span class=
"Apple-tab-span"> </span>l=
</span>"SUPERCOLLIDER"<span class=
"s2">.scramble;
</span></p>
204 <p class=
"p12"><span class=
"Apple-tab-span"> </span>t=
<span class=
"s3">Array
</span>.fill(
9,{
<span class=
"s3">arg
</span> i;
<span class=
"s3">var
</span> n,r,q;
</p>
205 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>n=
<span class=
"s3">CompositeView
</span>.new(v,
<span class=
"s3">Rect
</span>(
20,
20,
121,
121)).background_(
<span class=
"s3">Color
</span>.rand);
</p>
206 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q=
<span class=
"s3">StaticText
</span>(n, n.bounds.moveTo(
0,
0).insetBy(
25)).string_(l[i]).align_(
<span class=
"s8">\center
</span>);
</p>
207 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.enabled=
<span class=
"s3">true
</span>;
</p>
208 <p class=
"p15">//
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.font=Font(
"Geneva",
10);
</p>
209 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.font=
<span class=
"s3">Font
</span>(
<span class=
"s9">"Geneva"</span>,
10 )
<span class=
"s10">;
</span></p>
210 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.background_(
<span class=
"s3">Color
</span>.rand);
</p>
211 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.mouseDownAction={
</p>
212 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>n.background_(
<span class=
"s3">Color
</span>.rand);
</p>
213 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q.font=q.font.size_(
5+q.font.size+
7%
60)
</p>
214 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
215 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
216 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
217 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
218 <p class=
"p12"><span class=
"Apple-tab-span"> </span>)
</p>
219 <p class=
"p14"><br></p>
220 <p class=
"p4"><br></p>