Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCMultiSliderView.html
blobef7e9095e12a997d50cd9c63bd877190a72aea2f
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
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: 9.0px Monaco; min-height: 12.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001ee6}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
17 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
19 p.p10 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
23 p.p14 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
24 p.p15 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
25 p.p16 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
26 p.p17 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #000000}
27 p.p18 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #007300}
28 p.p19 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
29 p.p20 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
30 p.p21 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #bf0000}
31 p.p22 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #606060}
32 p.p23 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #0000bf}
33 p.p24 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
34 p.p25 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
35 span.s1 {font: 18.0px Helvetica}
36 span.s2 {color: #6b718a}
37 span.s3 {color: #000000}
38 span.s4 {text-decoration: underline}
39 span.s5 {color: #6f7178}
40 span.s6 {color: #0000bf}
41 span.s7 {color: #bf0000}
42 span.s8 {color: #676d92}
43 span.s9 {font: 12.0px Helvetica}
44 span.s10 {color: #656b96}
45 span.s11 {color: #666c94}
46 span.s12 {color: #636a99}
47 span.s13 {color: #696f8e}
48 span.s14 {color: #5f689f}
49 span.s15 {color: #61699c}
50 span.s16 {font: 14.0px Helvetica}
51 span.s17 {color: #6f7179}
52 span.s18 {font: 9.0px Monaco}
53 span.s19 {color: #606060}
54 span.s20 {color: #007300}
55 span.Apple-tab-span {white-space:pre}
56 </style>
57 </head>
58 <body>
59 <p class="p1"><span class="s1"><b>SCMultiSliderView<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a richly configurable view for graphically displaying and editing an array of values</b></p>
60 <p class="p2"><br></p>
61 <p class="p1"><b>Inherits from: </b><a href="../../Core/Object.html"><span class="s2"><b>Object</b></span></a><b> : </b><a href="SCView.html"><span class="s2"><b>SCView</b></span></a></p>
62 <p class="p3"><br></p>
63 <p class="p1">SCMultiSliderView on the surface is like a group of sliders. However, various graphical options allow you to use it for displaying and editing graphic representations of array values. It is also the super class of <a href="SCEnvelopeView.html"><span class="s2">SCEnvelopeView</span></a>.</p>
64 <p class="p2"><br></p>
65 <p class="p4"><span class="s3"><b>See also:</b> <a href="SCEnvelopeView.html"><span class="s4">SCEnvelopeView</span></a></span></p>
66 <p class="p2"><br></p>
67 <p class="p5"><b>Some Important Issues Regarding SCMultiSliderView</b></p>
68 <p class="p2"><br></p>
69 <p class="p1">If no instance variables other than parent and bounds are set, then a multislider with bounds.width/12 sliders is created. However, the default thumbSize is 12 and the gap default is 1. The view width has to be 13*n+2 for all the sliders to automatically fit in the view.</p>
70 <p class="p2"><br></p>
71 <p class="p1">So if you want a specific number of sliders, then it is best to specify the <b>size</b> and set <b>elasticMode</b> to 1. Then you will get a multislider which distrubutes <b>size</b> amount of sliders over <b>bounds.width</b>, where the slider widths are at <i>maximum</i> <b>indexThumbSize</b> (default 12) and the <b>gap</b> is adusted accordingly.</p>
72 <p class="p2"><br></p>
73 <p class="p5"><b>Creation / Class Methods</b></p>
74 <p class="p6"><br></p>
75 <p class="p7"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
76 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
77 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
78 <p class="p9"><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="s5">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s5">Point</span></a> indicating width@height.</p>
79 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
80 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
81 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n=20;</p>
82 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s6">Window</span>.new.front;</p>
83 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m = <span class="s6">MultiSliderView</span>(w,<span class="s6">Rect</span>(10,10,n*13+2,100)); <span class="s7">//default thumbWidth is 13</span></p>
84 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.value=</span><span class="s6">Array</span><span class="s3">.fill(n, {</span><span class="s6">|v|</span><span class="s3"> v*0.05}); </span>// size is set automatically when you set the value</p>
85 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.action = { <span class="s6">arg</span> q;</p>
86 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>q.value.postln;</p>
87 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>};</p>
88 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">)</span></p>
89 <p class="p6"><br></p>
90 <p class="p14"><b>Accessing Instance and Class Variables</b></p>
91 <p class="p15"><br></p>
92 <p class="p7"><b><span class="Apple-tab-span"> </span>size</b></p>
93 <p class="p7"><b><span class="Apple-tab-span"> </span>size_(arg1)</b></p>
94 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
95 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Gets/sets the size of the array returned by <b>action</b>, <i>if you explicitly set the size</i>. If you do not set the size nor value, then the size of the array returned by action will be the amount of sliders in the view, which is <b>bounds.width</b>/12. Changing <b>size, </b>after the the multislider has been drawn or after the <b>value</b> array has been set, will lead to unexpected results. Instead, you should change the content of <b>value, </b>if you need to change the multislider contents.</p>
96 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
97 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 - </b>An Integer.</p>
98 <p class="p8"><span class="Apple-tab-span"> </span></p>
99 <p class="p7"><b><span class="Apple-tab-span"> </span>indexIsHorizontal_ (val)</b></p>
100 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
101 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Determines the index direction (vertical/horizontal) of the slider.</p>
102 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An instance of <a href="../../Core/Boolean.html"><span class="s8">Boolean</span></a>. Default is true.</p>
103 <p class="p10"><br></p>
104 <p class="p7"><b><span class="Apple-tab-span"> </span>editable</b></p>
105 <p class="p7"><b><span class="Apple-tab-span"> </span>editable_ (val)</b></p>
106 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
107 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Determines if the sliders are editable. If editable is false, the multislider will still execute <b>action</b> on mouse click.</p>
108 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An instance of <a href="../../Core/Boolean.html"><span class="s8">Boolean</span></a>.</p>
109 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
110 <p class="p7"><b><span class="Apple-tab-span"> </span>readOnly_ (val)</b></p>
111 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
112 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- boolean.</p>
113 <p class="p6"><span class="s9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
114 <p class="p7"><b><span class="Apple-tab-span"> </span>step</b></p>
115 <p class="p7"><b><span class="Apple-tab-span"> </span>step_ (stepSize)</b></p>
116 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
117 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Quantizes the values to the nearest multiple of stepSize.</p>
118 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>stepSize </b>- An instance of <a href="../../Math/Float.html"><span class="s10">Float</span></a>.</p>
119 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
120 <p class="p14"><b>Accessing and Setting Values</b></p>
121 <p class="p15"><br></p>
122 <p class="p7"><b><span class="Apple-tab-span"> </span>value</b></p>
123 <p class="p7"><b><span class="Apple-tab-span"> </span>value_ (val)</b></p>
124 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
125 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Gets/sets the property, \value, by calling get/setProperty(\value, <b>val</b>). The setter also sets <b>size</b> to the size of <b>val</b>. This will not do the <b>action</b> of the slider.</p>
126 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An instance of <a href="../../Collections/Array.html"><span class="s11">Array</span></a>.</p>
127 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
128 <p class="p7"><b><span class="Apple-tab-span"> </span>valueAction_ (val)</b></p>
129 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
130 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Sets the property, \value, by calling setPropertyWithAction(\value, <b>val</b>). Also sets <b>size</b> to the size of <b>val. </b>Does the sliders <b>action</b>.</p>
131 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An instance of <a href="../../Collections/Array.html"><span class="s11">Array</span></a>.</p>
132 <p class="p15"><br></p>
133 <p class="p7"><b><span class="Apple-tab-span"> </span>index</b></p>
134 <p class="p7"><b><span class="Apple-tab-span"> </span>index_ (inx)</b></p>
135 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
136 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets the first index of the selection range.</p>
137 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>inx </b>- an integer.</p>
138 <p class="p6"><span class="s9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
139 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionSize</b></p>
140 <p class="p7"><b><span class="Apple-tab-span"> </span>selectionSize_ (aval)</b></p>
141 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
142 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets the size of the selection. Can be 0.</p>
143 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>aval </b>- An integer.</p>
144 <p class="p6"><span class="s9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
145 <p class="p7"><b><span class="Apple-tab-span"> </span>startIndex_ (val)</b></p>
146 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
147 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An integer.</p>
148 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
149 <p class="p7"><b><span class="Apple-tab-span"> </span>currentvalue</b></p>
150 <p class="p7"><b><span class="Apple-tab-span"> </span>currentvalue_ (iny)</b></p>
151 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
152 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Gets/sets the value at the current <b>index</b>.</p>
153 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>iny </b>- A float between 0 and 1.</p>
154 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
155 <p class="p7"><b><span class="Apple-tab-span"> </span>reference</b></p>
156 <p class="p7"><b><span class="Apple-tab-span"> </span>reference_ (val)</b></p>
157 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
158 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets a reference value, and draws it according to other drawing options: as a line, or a thumb.<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
159 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- An <a href="../../Collections/Array.html"><span class="s12">Array</span></a> of <a href="../../Math/Float.html"><span class="s12">Float</span></a>s between 0 and 1;</p>
160 <p class="p6"><span class="s9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
161 <p class="p7"><b><span class="Apple-tab-span"> </span>metaAction_(arg1)</b></p>
162 <p class="p7"><b><span class="Apple-tab-span"> </span>metaAction</b></p>
163 <p class="p8"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
164 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Gets/sets a function to be evaluate on Ctrl-click</p>
165 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 - </b>An instance of <a href="../../Core/Kernel/Function.html"><span class="s13">Function</span></a>. Default value is nil.</p>
166 <p class="p15"><br></p>
167 <p class="p14"><b>Customizing Appearance</b></p>
168 <p class="p6"><br></p>
169 <p class="p7"><b><span class="Apple-tab-span"> </span>showIndex_ (abool)</b></p>
170 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
171 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Highlights the currently selected index.</p>
172 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>abool </b>- An Instance of <a href="../../Core/Boolean.html"><span class="s10">Boolean</span></a>. Default is false.</p>
173 <p class="p6"><br></p>
174 <p class="p7"><b><span class="Apple-tab-span"> </span>elasticMode</b></p>
175 <p class="p7"><b><span class="Apple-tab-span"> </span>elasticMode_ (mode)</b></p>
176 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
177 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Determines if the sliders are distributed over the width of the view. If resize is 2, 3, or 8, then the width and gap of the individual sliders will adjust automatically using a maximum slider with of <b>thumbSize</b>.</p>
178 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>mode </b>- 0 or 1</p>
179 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
180 <p class="p7"><b><span class="Apple-tab-span"> </span>thumbSize_ (val)</b></p>
181 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
182 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the <b>indexThumbSize_</b> of the sliders. If elasticMode is 1, then it determines the maximum indexThumbSize of the slider as well as the <b><span class="Apple-tab-span"> </span></b>valueThumbSize.</p>
183 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- A Float or Integer.</p>
184 <p class="p6"><br></p>
185 <p class="p7"><b><span class="Apple-tab-span"> </span>indexThumbSize_ (val)</b></p>
186 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
187 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The size of the slider thumb in the index direction.</p>
188 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- A Float or Integer.</p>
189 <p class="p6"><br></p>
190 <p class="p7"><b><span class="Apple-tab-span"> </span>valueThumbSize_ (val)</b></p>
191 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
192 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The size of the slider thumb in the value direction.</p>
193 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>val </b>- A Float or Integer.</p>
194 <p class="p6"><br></p>
195 <p class="p7"><b><span class="Apple-tab-span"> </span>drawLines (abool)</b></p>
196 <p class="p7"><b><span class="Apple-tab-span"> </span>drawLines_ (abool)</b></p>
197 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
198 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Draws connecting lines between the values.</p>
199 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>abool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s11">Boolean</span></a>. default is false.</p>
200 <p class="p6"><br></p>
201 <p class="p7"><b><span class="Apple-tab-span"> </span>drawRects_ (abool)</b></p>
202 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
203 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Draws the thumbs of the sliders.</p>
204 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>abool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s11">Boolean</span></a>. default is true.</p>
205 <p class="p8"><span class="Apple-tab-span"> </span></p>
206 <p class="p7"><b><span class="Apple-tab-span"> </span>gap</b></p>
207 <p class="p7"><b><span class="Apple-tab-span"> </span>gap_ (inx)</b></p>
208 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
209 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Set/get the property, \xOffset, which is gap between the sliders. This value is ignored if <b>elasticMode</b> is set to 1.</p>
210 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>inx </b>- An integer.</p>
211 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
212 <p class="p7"><b><span class="Apple-tab-span"> </span>isFilled_ (abool)</b></p>
213 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
214 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>If set to true, this extends the thumb-rectangle to the edge, like in a bar graph. Fills the area between 0 and the value, or between 0 and the reference, depending on other draw options. If drawLines_(true) and drawRects_(false) and isFilled_(true), then it will fill the value between the value and the reference only.</p>
215 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>abool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s14">Boolean</span></a>.</p>
216 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
217 <p class="p16"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(</p>
218 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n=80;</p>
219 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w = <span class="s6">Window</span>.new;</p>
220 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m = <span class="s6">MultiSliderView</span>(w,<span class="s6">Rect</span>(10,10,20*13+2,100)); <span class="s7">//default thumbWidth is 13</span></p>
221 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.elasticMode_(1);</p>
222 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.value=<span class="s6">Array</span>.fill(n, {<span class="s6">|v|</span> 1.0.rand});</p>
223 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.reference=<span class="s6">Array</span>.fill(n, {<span class="s6">|v|</span> 0.5});</p>
224 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.action = { <span class="s6">arg</span> q;q.value.postln; };</p>
225 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.isFilled_ (<span class="s6">true</span>);</p>
226 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.drawLines_(<span class="s6">true</span>);</p>
227 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>m.drawRects_(<span class="s6">false</span>);</p>
228 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>w.front;</p>
229 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">)</span></p>
230 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
231 <p class="p7"><b><span class="Apple-tab-span"> </span>fillColor_ (acolor)</b></p>
232 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
233 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The fill color of the view.</p>
234 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>acolor </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s15">Color</span></a>.</p>
235 <p class="p6"><br></p>
236 <p class="p7"><b><span class="Apple-tab-span"> </span>strokeColor_ (acolor)</b></p>
237 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
238 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The line color of the view.</p>
239 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>acolor </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s15">Color</span></a>.</p>
240 <p class="p6"><br></p>
241 <p class="p7"><b><span class="Apple-tab-span"> </span>colors_ (strokec, fillc)</b></p>
242 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
243 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Sets the stroke and fill colors of the graph.</p>
244 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>strokec </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s15">Color</span></a>.</p>
245 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>fillc </b>- An instance of <a href="../GUI-Tools/Color.html"><span class="s15">Color</span></a>.</p>
246 <p class="p6"><br></p>
247 <p class="p14"><b>Subclassing and Internal Methods</b></p>
248 <p class="p7"><span class="s16"><span class="Apple-tab-span"> </span></span>The following methods are usually not used directly or are called by a primitive. Programmers can still call or override these as needed.</p>
249 <p class="p6"><br></p>
250 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultKeyDownAction (char, modifiers, unicode)</b></p>
251 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
252 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default keydown actions are:</p>
253 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
254 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>key</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>action</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>comment</b></p>
255 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF703, <span class="Apple-tab-span"> </span>increment index by <b>1</b><span class="Apple-tab-span"> </span>right arrow</p>
256 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF702, <span class="Apple-tab-span"> </span>decrement index by <b>1</b><span class="Apple-tab-span"> </span>left arrow<span class="Apple-tab-span"> </span></p>
257 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF700, <span class="Apple-tab-span"> </span>decrement gap by <b>1</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>up arrow</p>
258 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>unicode 16rF701, <span class="Apple-tab-span"> </span>increment gap by <b>1</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>down arrow</p>
259 <p class="p6"><br></p>
260 <p class="p7"><b><span class="Apple-tab-span"> </span>properties</b></p>
261 <p class="p8"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></p>
262 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>A list of properties to which this view responds. See <a href="SCView.html"><span class="s17">SCView</span></a>.</p>
263 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
264 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns:</p>
265 <p class="p18"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[ </span>\bounds<span class="s3">, </span>\visible<span class="s3">, </span>\enabled<span class="s3">, </span>\canFocus<span class="s3">, </span>\resize<span class="s3">, </span>\background<span class="s3">, </span>\minWidth<span class="s3">, </span>\maxWidth<span class="s3">, </span>\minHeight<span class="s3">, </span>\maxHeight<span class="s3">, </span>\value<span class="s3">, </span>\thumbSize<span class="s3">, </span>\fillColor<span class="s3">, </span>\strokeColor<span class="s3">, </span>\xOffset<span class="s3">, </span>\x<span class="s3">, </span>\y<span class="s3">, </span>\showIndex<span class="s3">, </span>\drawLines<span class="s3">, </span>\drawRects<span class="s3">, </span>\selectionSize<span class="s3">, </span>\startIndex<span class="s3">, </span>\referenceValues<span class="s3">, </span>\thumbWidth<span class="s3">, </span>\absoluteX<span class="s3">, </span>\isFilled<span class="s3">, </span>\step<span class="s3">, </span>\elasticResizeMode<span class="s3"> ]<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span></p>
266 <p class="p7"><b><span class="Apple-tab-span"> </span>defaultGetDrag</b></p>
267 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
268 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>The method called by default when initiating a drag <b>from</b> an SCNumberBox.</p>
269 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Tho following describes the defaultbehavior:</p>
270 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
271 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a) if selectionSize is 0, returns the content of value (an Array):</p>
272 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b) if selectionSize &gt; 1, returns an Array with the values at the indexes in the selection;</p>
273 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
274 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>if references is not nil, returns an array containing (a) or (b) , and an array of the relevant reference values ; [ [values], [references] ]</p>
275 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
276 <p class="p7"><span class="Apple-tab-span"> </span><b>defaultCanReceiveDrag</b></p>
277 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
278 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The method called by default when attempting to place a drag in this object. Will recieve any drag, but the drag should either be an array of values, ( [ values ] ), or an array containg an array of values and an array of reference values ( [ [values], [references] ] ).</p>
279 <p class="p8"><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 class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s18"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span></p>
280 <p class="p7"><span class="Apple-tab-span"> </span><b>defaultReceiveDrag</b></p>
281 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
282 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>The default method called when a drag has been received. If the <b>currentDrag</b> is a String, then Performs <b>value_()</b> <b>and reference_()</b> using <b>currentDrag</b> as an argument. Does not perform the <b>action</b>.</p>
283 <p class="p6"><br></p>
284 <p class="p7"><b><span class="Apple-tab-span"> </span>doMetaAction</b></p>
285 <p class="p8"><b><span class="Apple-tab-span"> </span></b></p>
286 <p class="p7"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Not normally called directly (called by the primitive).</p>
287 <p class="p6"><br></p>
288 <p class="p6"><br></p>
289 <p class="p14"><b>Examples</b></p>
290 <p class="p19"><br></p>
291 <p class="p13">// basic</p>
292 <p class="p12">(</p>
293 <p class="p12">n=20;</p>
294 <p class="p12">w = <span class="s6">Window</span>.new.front;</p>
295 <p class="p12">m = <span class="s6">MultiSliderView</span>(w,<span class="s6">Rect</span>(10,10,n*13+2,100)); <span class="s7">//default thumbWidth is 13</span></p>
296 <p class="p13"><span class="s3">m.value=</span><span class="s6">Array</span><span class="s3">.fill(n, {</span><span class="s6">|v|</span><span class="s3"> v*0.05}); </span>// size is set automatically when you set the value</p>
297 <p class="p12">m.action = { <span class="s6">arg</span> q;</p>
298 <p class="p12"><span class="Apple-tab-span"> </span>q.value.postln;</p>
299 <p class="p12">};</p>
300 <p class="p12">)<span class="Apple-tab-span"> </span></p>
301 <p class="p19"><br></p>
302 <p class="p19"><br></p>
303 <p class="p13">// looks like a candlestick graph</p>
304 <p class="p12">(</p>
305 <p class="p12"><span class="s6">var</span> size;</p>
306 <p class="p12">size = 350 / 6;</p>
307 <p class="p12">w = <span class="s6">Window</span>.new;</p>
308 <p class="p12">w.view.decorator = <span class="s6">FlowLayout</span>(w.view.bounds);</p>
309 <p class="p12">m = <span class="s6">MultiSliderView</span>(w, <span class="s6">Rect</span>(0, 0, 350, 100));<span class="Apple-tab-span"> </span></p>
310 <p class="p12">m.value_(<span class="s6">Array</span>.fill(size, {0.01}));</p>
311 <p class="p13"><span class="s3">m.isFilled_(</span><span class="s6">true</span><span class="s3">); </span>// width in pixels of each stick</p>
312 <p class="p13"><span class="s3">m.indexThumbSize_(2.0); </span>// spacing on the value axis</p>
313 <p class="p12">m.gap_(4);</p>
314 <p class="p12">w.front;</p>
315 <p class="p12">)</p>
316 <p class="p19"><br></p>
317 <p class="p13">// rotate the above graph</p>
318 <p class="p12">(</p>
319 <p class="p12">m.bounds_(<span class="s6">Rect</span>(0, 0, 100, 350));</p>
320 <p class="p12">m.indexIsHorizontal_(<span class="s6">false</span>);</p>
321 <p class="p12">)</p>
322 <p class="p3"><br></p>
323 <p class="p3"><br></p>
324 <p class="p14"><b>Interactive Example (explains all the graphic options)</b></p>
325 <p class="p19"><br></p>
326 <p class="p17">(</p>
327 <p class="p17">n=40;</p>
328 <p class="p20"><br></p>
329 <p class="p17">w = <span class="s6">Window</span>(<span class="s19">"MultiSlider Options"</span>, <span class="s6">Rect</span>(200, <span class="s6">Window</span>.screenBounds.height-550, 600, 450));</p>
330 <p class="p17">f={<span class="Apple-tab-span"> </span></p>
331 <p class="p17"><span class="Apple-tab-span"> </span>w.view.decorator = <span class="s6">FlowLayout</span>( w.view.bounds, 10@10, 10@2 );</p>
332 <p class="p21"><span class="s3"><span class="Apple-tab-span"> </span>m = </span><span class="s6">MultiSliderView</span><span class="s3">(w,</span><span class="s6">Rect</span><span class="s3">(0,0,580,200)); </span>// default thumbWidth is 13</p>
333 <p class="p17"><span class="Apple-tab-span"> </span>m.value=<span class="s6">Array</span>.fill(n, {<span class="s6">|v|</span> 0.5+((0.3*v).sin*0.25)});</p>
334 <p class="p17"><span class="Apple-tab-span"> </span>m.action = { <span class="s6">arg</span> q;q.value.postln; };</p>
335 <p class="p20"><span class="Apple-tab-span"> </span></p>
336 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">StaticText</span><span class="s3">(w,380@18).string_(</span>"indexThumbSize or thumbSize"<span class="s3">);</span></p>
337 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Slider</span>(w,580@10).action_({<span class="s6">arg</span> sl; m.indexThumbSize=sl.value*24}).value_(0.5);</p>
338 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">StaticText</span>(w,380@18).string_(<span class="s19">"valueThumbSize"</span>);</p>
339 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Slider</span>(w,580@10).action_({<span class="s6">arg</span> sl; m.valueThumbSize=sl.value*24}).value_(0.5);</p>
340 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">StaticText</span>(w,580@18).string_(<span class="s19">"xOffset or gap"</span>);</p>
341 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Slider</span>(w,580@10).action_({<span class="s6">arg</span> sl;0.5- m.xOffset=sl.value*50});</p>
342 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">StaticText</span><span class="s3">(w,580@18).string_(</span>"setProperty(\\startIndex)"<span class="s3">);</span></p>
343 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Slider</span>(w,580@10).action_({<span class="s6">arg</span> sl; m.setProperty(<span class="s20">\startIndex</span>, sl.value *m.size )};);</p>
344 <p class="p20"><span class="Apple-tab-span"> </span></p>
345 <p class="p23"><span class="s3"><span class="Apple-tab-span"> </span></span>CompositeView<span class="s3">(w,580@10);</span><span class="s7">//spacer</span></p>
346 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,100@20).states_([[<span class="s19">"RESET"</span>,<span class="s6">Color</span>.red]])</p>
347 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({ w.view.removeAll; f.value; });</p>
348 <p class="p17"><span class="Apple-tab-span"> </span>h=<span class="s6">StaticText</span>(w,450@18).string_(<span class="s19">""</span>).stringColor_(<span class="s6">Color</span>.yellow);</p>
349 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,100@20).states_([[<span class="s19">"elasticMode = 0"</span>],[<span class="s19">"elasticMode = 1"</span>,<span class="s6">Color</span>.white]])</p>
350 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.elasticMode = b.value});</p>
351 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">Button</span><span class="s3">(w,160@20).states_([[</span>"indexIsHorizontal = false"<span class="s3">],[</span>"indexIsHorizontal = true"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.white]])</span></p>
352 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.indexIsHorizontal = b.value.booleanValue}).value_(1);</p>
353 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,120@20).states_([[<span class="s19">"isFilled = false"</span>],[<span class="s19">"isFilled = true"</span>,<span class="s6">Color</span>.white]])</p>
354 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.isFilled = b.value.booleanValue});</p>
355 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">Button</span><span class="s3">(w,120@20).states_([[</span>"drawRects = false"<span class="s3">],[</span>"drawRects = true"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.white]])</span></p>
356 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.drawRects = b.value.booleanValue}).valueAction_(1);</p>
357 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">Button</span><span class="s3">(w,100@20).states_([[</span>"drawLines = false"<span class="s3">],[</span>"drawLines = true"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.white]])</span></p>
358 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.drawLines = b.value.booleanValue});</p>
359 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,160@20).states_([[<span class="s19">"readOnly = false"</span>],[<span class="s19">"readOnly = true"</span>,<span class="s6">Color</span>.white]])</p>
360 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.readOnly = b.value.booleanValue});</p>
361 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">Button</span><span class="s3">(w,120@20).states_([[</span>"showIndex = false"<span class="s3">],[</span>"showIndex = true"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.white]])</span></p>
362 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> m.showIndex = b.value.booleanValue});</p>
363 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s6">Button</span><span class="s3">(w,120@20).states_([[</span>"reference = nil"<span class="s3">],[</span>"reference filled"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.white],[</span>"reference random"<span class="s3">,</span><span class="s6">Color</span><span class="s3">.yellow]])</span></p>
364 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>.action_({<span class="s6">|b|</span> b.value.booleanValue.if({</p>
365 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(b.value&gt;1).if(</p>
366 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{m.reference=<span class="s6">Array</span>.fill(n, {1.0.rand})},</p>
367 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{m.reference=<span class="s6">Array</span>.fill(m.size, {0.5})});</p>
368 <p class="p22"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>},{ q=m.value;m.reference=[]; h.string=</span>"reference can't be returned to nil presently. please hit RESET."<span class="s3">}</span></p>
369 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
370 <p class="p17"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
371 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,180@20).states_([[<span class="s19">"fillColor = Color.rand"</span>]]).action_({m.fillColor=<span class="s6">Color</span>.rand});</p>
372 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,180@20).states_([[<span class="s19">"strokeColor = Color.rand"</span>]]).action_({m.strokeColor=<span class="s6">Color</span>.rand});</p>
373 <p class="p17"><span class="Apple-tab-span"> </span><span class="s6">Button</span>(w,180@20).states_([[<span class="s19">"background = Color.rand"</span>]]).action_({m.background=<span class="s6">Color</span>.rand});</p>
374 <p class="p20"><span class="Apple-tab-span"> </span></p>
375 <p class="p17">};</p>
376 <p class="p17">f.value;</p>
377 <p class="p17">w.front;</p>
378 <p class="p20"><br></p>
379 <p class="p17">)</p>
380 <p class="p20"><br></p>
381 <p class="p6"><br></p>
382 <p class="p14"><b>Load a Sound file</b></p>
383 <p class="p3"><br></p>
384 <p class="p19"><br></p>
385 <p class="p12">(</p>
386 <p class="p13">// press shift to extend the selection</p>
387 <p class="p13">// use as waveView: scrubbing over the view returns index</p>
388 <p class="p13">// if showIndex(false) the view is not refreshed (faster);</p>
389 <p class="p13">// otherwise you can make a selection with shift - drag.</p>
390 <p class="p12"><span class="s6">var</span> size, file, maxval, minval;</p>
391 <p class="p12">size = 640;</p>
392 <p class="p12">a = <span class="s6">Window</span>(<span class="s19">"test"</span>, <span class="s6">Rect</span>(200 , 140, 650, 150));</p>
393 <p class="p12">a.view.decorator = <span class="s6">FlowLayout</span>(a.view.bounds);</p>
394 <p class="p12">b = <span class="s6">MultiSliderView</span>(a, <span class="s6">Rect</span>(0, 0, size, 50));</p>
395 <p class="p12">b.readOnly_(<span class="s6">true</span>);</p>
396 <p class="p12">a.view.decorator.nextLine;</p>
397 <p class="p19"><br></p>
398 <p class="p19"><br></p>
399 <p class="p19"><br></p>
400 <p class="p12">d = <span class="s6">Array</span>.new;</p>
401 <p class="p12">c = <span class="s6">FloatArray</span>.newClear(65493);</p>
402 <p class="p19"><br></p>
403 <p class="p12">r = <span class="s6">Slider</span>( a, <span class="s6">Rect</span>(0, 0, size, 12));</p>
404 <p class="p12">r.action = {<span class="s6">arg</span> ex; b.setProperty(<span class="s20">\xOffset</span>, (ex.value * 4) + 1 )};</p>
405 <p class="p19"><br></p>
406 <p class="p12">file = <span class="s6">SoundFile</span>.new;</p>
407 <p class="p24"><span class="s3">file.openRead(</span>"sounds/a11wlk01.wav"<span class="s3">);</span></p>
408 <p class="p12">file.numFrames.postln;</p>
409 <p class="p12">file.readData(c);</p>
410 <p class="p13">// file.inspect;</p>
411 <p class="p12">file.close;</p>
412 <p class="p12">minval = 0;</p>
413 <p class="p12">maxval = 0;</p>
414 <p class="p12">f = <span class="s6">Array</span>.new;</p>
415 <p class="p12">d = <span class="s6">Array</span>.new;</p>
416 <p class="p12">c.do({<span class="s6">arg</span> fi, i;</p>
417 <p class="p12"><span class="Apple-tab-span"> </span>if(fi &lt; minval, {minval = fi});</p>
418 <p class="p12"><span class="Apple-tab-span"> </span>if(fi &gt; maxval, {maxval = fi});</p>
419 <p class="p19"><br></p>
420 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span></span>//f.postln;</p>
421 <p class="p12"><span class="Apple-tab-span"> </span>if(i % 256 == 0,{</p>
422 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>d = d.add((1 + maxval ) * 0.5 );</p>
423 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f = f.add((1 + minval ) * 0.5 );</p>
424 <p class="p19"><span class="Apple-tab-span"> </span></p>
425 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>minval = 0;</p>
426 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>maxval = 0;</p>
427 <p class="p12"><span class="Apple-tab-span"> </span>});</p>
428 <p class="p12">});</p>
429 <p class="p19"><br></p>
430 <p class="p13"><span class="s3">b.reference_(d); </span>// this is used to draw the upper part of the table</p>
431 <p class="p12">b.value_(f);</p>
432 <p class="p19"><br></p>
433 <p class="p12">r = <span class="s6">Slider</span>( a, <span class="s6">Rect</span>(0, 0, size, 12));</p>
434 <p class="p12">r.action = {<span class="s6">arg</span> ex; b.setProperty(<span class="s20">\startIndex</span>, ex.value *f.size )};</p>
435 <p class="p19"><br></p>
436 <p class="p13">// b.enabled_(false);</p>
437 <p class="p12">b.action = {<span class="s6">arg</span> xb; (<span class="s19">"index: "</span> ++ xb.index).postln};</p>
438 <p class="p12">b.drawLines_(<span class="s6">true</span>);</p>
439 <p class="p12">b.drawRects_(<span class="s6">false</span>);</p>
440 <p class="p12">b.isFilled_(<span class="s6">true</span>);</p>
441 <p class="p12">b.selectionSize_(10);</p>
442 <p class="p12">b.index_(10);</p>
443 <p class="p12">b.thumbSize_(1);</p>
444 <p class="p12">b.gap_(0);</p>
445 <p class="p12">b.colors_(<span class="s6">Color</span>.black, <span class="s6">Color</span>.blue(1.0,1.0));</p>
446 <p class="p12">b.showIndex_(<span class="s6">true</span>);</p>
447 <p class="p12">a.front;</p>
448 <p class="p19"><br></p>
449 <p class="p12">)</p>
450 <p class="p3"><br></p>
451 <p class="p1"><b>Use as Sequencer</b></p>
452 <p class="p25"><br></p>
453 <p class="p13">// example with sound</p>
454 <p class="p12">(</p>
455 <p class="p12"><span class="s6">var</span> size;</p>
456 <p class="p12">size = 12;</p>
457 <p class="p12">s.waitForBoot{<span class="Apple-tab-span"> </span></p>
458 <p class="p12"><span class="Apple-tab-span"> </span>n={<span class="s6">arg</span> freq=330; <span class="s6">SinOsc</span>.ar(freq,0,0.2)}.play;</p>
459 <p class="p19"><br></p>
460 <p class="p12"><span class="Apple-tab-span"> </span>w = <span class="s6">Window</span>(<span class="s19">"test"</span>, <span class="s6">Rect</span>(200 , 450, 10 + (size * 17), 10 + (size * 17)));</p>
461 <p class="p12"><span class="Apple-tab-span"> </span>w.view.decorator = <span class="s6">FlowLayout</span>(w.view.bounds);</p>
462 <p class="p12"><span class="Apple-tab-span"> </span>b = <span class="s6">MultiSliderView</span>(w, <span class="s6">Rect</span>(0, 0, size * 17, size * 17));</p>
463 <p class="p12"><span class="Apple-tab-span"> </span>b.value_( <span class="s6">Array</span>.fill(size,{<span class="s6">|i|</span> i/size}) );</p>
464 <p class="p12"><span class="Apple-tab-span"> </span>b.background_(<span class="s6">Color</span>.rand);</p>
465 <p class="p12"><span class="Apple-tab-span"> </span>b.action = {<span class="s6">arg</span> xb;</p>
466 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.set(<span class="s20">\freq</span>, 330+(1100*xb.value.at(xb.index)));</p>
467 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>(<span class="s19">"index: "</span> ++ xb.index ++<span class="s19">" value: "</span> ++ xb.value.at(xb.index)).postln};</p>
468 <p class="p13"><span class="s3"><span class="Apple-tab-span"> </span>b.elasticMode_(1); </span>// makes the squares fit evenly</p>
469 <p class="p12"><span class="Apple-tab-span"> </span>b.setProperty(<span class="s20">\showIndex</span>, <span class="s6">true</span>); <span class="s7">// cursor mode</span></p>
470 <p class="p12"><span class="Apple-tab-span"> </span>b.readOnly=<span class="s6">true</span>;</p>
471 <p class="p12"><span class="Apple-tab-span"> </span>w.front;</p>
472 <p class="p19"><span class="Apple-tab-span"> </span></p>
473 <p class="p12"><span class="Apple-tab-span"> </span>r = <span class="s6">Routine</span>({</p>
474 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0.1.wait;</p>
475 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>30.do({ <span class="s6">arg</span> i;</p>
476 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.index_(i%size);</p>
477 <p class="p19"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
478 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.doAction;</p>
479 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0.1.wait;</p>
480 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
481 <p class="p19"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
482 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>20.do({ <span class="s6">arg</span> i;</p>
483 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.index_(b.size.rand);</p>
484 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>b.doAction;</p>
485 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[0.1,0.2].choose.wait;</p>
486 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>});</p>
487 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>1.wait;</p>
488 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.free;</p>
489 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>{w.close}.defer;</p>
490 <p class="p12"><span class="Apple-tab-span"> </span>});</p>
491 <p class="p12"><span class="Apple-tab-span"> </span><span class="s6">AppClock</span>.play(r);</p>
492 <p class="p12">};</p>
493 <p class="p12">)</p>
494 <p class="p12">Note: <span class="s6">this</span> forces the entire view to redraw at each step and will spend a lot of <span class="s6">CPU</span>.</p>
495 <p class="p19"><br></p>
496 <p class="p3"><br></p>
497 </body>
498 </html>