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.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.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
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf}
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: 12.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
; 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: #606060}
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: 9.0px Monaco
}
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
; color: #007300}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
28 span
.s1
{font: 12.0px Helvetica
}
29 span
.s2
{color: #0000bf}
30 span
.s3
{color: #0000bf}
31 span
.s4
{color: #000000}
32 span
.s5
{text-decoration: underline
}
33 span
.s6
{color: #0000bf}
34 span
.s7
{color: #0000bf}
35 span
.s8
{color: #0000bf}
36 span
.s9
{color: #0000bf}
37 span
.s10
{color: #0000bf}
38 span
.s11
{font: 14.0px Helvetica
}
39 span
.s12
{font: 12.0px Helvetica
; color: #000000}
40 span
.s13
{color: #bf0000}
41 span
.s14
{color: #606060}
42 span
.s15
{color: #007300}
43 span
.Apple-tab-span
{white-space:pre
}
47 <p class=
"p1"><b>SCListView
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b><span class=
"s1"><b>a list view
</b></span><b><span class=
"Apple-tab-span"> </span></b></p>
48 <p class=
"p2"><br></p>
49 <p class=
"p3"><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><b> :
</b><a href=
"SCControlView.html"><span class=
"s3"><b>SCControlView
</b></span></a></p>
50 <p class=
"p2"><br></p>
51 <p class=
"p4"><span class=
"s4"><b>See also:
</b> <a href=
"SCPopUpMenu.html"><span class=
"s5">SCPopUpMenu
</span></a></span></p>
52 <p class=
"p2"><br></p>
53 <p class=
"p5"><b>Some Important Issues Regarding SCListView
</b></p>
54 <p class=
"p2"><br></p>
55 <p class=
"p6">By default, SCSlider will respond only to drags where the drag contains a
<a href=
"../../Math/Number.html"><span class=
"s6">Number
</span></a>.
</p>
56 <p class=
"p2"><br></p>
57 <p class=
"p5"><b>Creation / Class Methods
</b></p>
58 <p class=
"p7"><br></p>
59 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>*new (parent, bounds)
</b></p>
60 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
61 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>parent
</b>- The parent view.
</p>
62 <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=
"s7">Rect
</span></a>, or a
<a href=
"../../Geometry/Point.html"><span class=
"s7">Point
</span></a> indicating width@height.
</p>
63 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
64 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
65 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s8">Window
</span>.new.front;
</p>
66 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>v =
<span class=
"s8">ListView
</span>(w,
<span class=
"s8">Rect
</span>(
10,
10,
120,
200));
</p>
67 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>v.items = [
</span>"item 1"<span class=
"s4">,
</span>"item 2"<span class=
"s4">,
</span>"item 3"<span class=
"s4">,
</span>"item 4"<span class=
"s4">,
</span>"item 5"<span class=
"s4">];
</span></p>
68 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>v.action = {
<span class=
"s8">arg
</span> q; [ q.value, v.items[ q.value ] ].postln;
<span class=
"Apple-tab-span"> </span>};
</p>
69 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
70 <p class=
"p7"><br></p>
71 <p class=
"p13"><b>Accessing Instance and Class Variables
</b></p>
72 <p class=
"p8"><br></p>
73 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>items
</b></p>
74 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>items_ (array)
</b></p>
75 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
76 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>array
</b>- An
<a href=
"../../Collections/Array.html"><span class=
"s7">Array
</span></a> of
<a href=
"../../Collections/String.html"><span class=
"s7">String
</span></a>s or
<a href=
"../../Core/Symbol.html"><span class=
"s7">Symbol
</span></a>s, which make up the items in the pop up menu.
</p>
77 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
78 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>item
</b></p>
79 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
80 <p class=
"p14"><span class=
"s1"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Returns
</span> items.at(
<span class=
"s9">this
</span>.value)
</p>
81 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
82 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>value
</b></p>
83 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>value_ (val)
</b></p>
84 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
85 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Gets/sets the index of the currently highlighted item. This will
<b>not
</b> do the
<b>action
</b>.
</p>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- The index of an item in the
<b>items
</b> array .
</p>
87 <p class=
"p7"><br></p>
88 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>valueAction_ (val)
</b></p>
89 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
90 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Sets the menu to highlight the item at index
<b>val
</b>, and evaluates
<b>action
</b> (see
<a href=
"SCView.html"><span class=
"s7">SCView
</span></a>), if the value has changed.
</p>
91 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>val
</b>- The index of an item in the
<b>items
</b> array .
</p>
92 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
93 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>enterKeyAction_(arg1)
</b></p>
94 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>enterKeyAction
</b></p>
95 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
96 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Instead of, or additionally to defining an action (see
<a href=
"SCView.html"><span class=
"s2">SCView
</span></a>), you can define an action which will be performed only if you hit the enter key while the list view is focussed.
</p>
97 <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></p>
98 <p class=
"p13"><b>Customizing Appearance
</b></p>
99 <p class=
"p15"><br></p>
100 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>font
</b></p>
101 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>font_ (argFont)
</b></p>
102 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
103 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Sets the
<a href=
"../Main-GUI/Font.html"><span class=
"s7">Font
</span></a> of the list. Default value is the default font: Font.default .
</p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>argFont
</b> - An instance of
<a href=
"../Main-GUI/Font.html"><span class=
"s7">Font
</span></a>.
</p>
105 <p class=
"p8"><br></p>
106 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>stringColor
</b></p>
107 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>stringColor_ (color)
</b></p>
108 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
109 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Set the string
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a> for the unselected items in the list .
</p>
110 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a>.
</p>
111 <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></p>
112 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>selectedStringColor
</b></p>
113 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>selectedStringColor_ (color)
</b></p>
114 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
115 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Set the string
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a> for the selected item .
</p>
116 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a>.
</p>
117 <p class=
"p7"><br></p>
118 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>hiliteColor
</b></p>
119 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>hiliteColor_ (color)
</b></p>
120 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
121 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Set the background
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a> for the selected item .
</p>
122 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>color
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s7">Color
</span></a>.
</p>
123 <p class=
"p8"><br></p>
124 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>colors
</b></p>
125 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>colors_(incolors)
</b></p>
126 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
127 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Set the background Color for the items.
</p>
128 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>incolor
</b> - An
<a href=
"../../Collections/Array.html"><span class=
"s10">Array
</span></a> of
<a href=
"../GUI-Tools/Color.html"><span class=
"s10">Color
</span></a>s
</p>
129 <p class=
"p8"><br></p>
130 <p class=
"p13"><b>Subclassing and Internal Methods
</b></p>
131 <p class=
"p6"><span class=
"s11"><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>
132 <p class=
"p8"><br></p>
133 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>defaultKeyDownAction (char, modifiers, unicode)
</b></p>
134 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
135 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The default keydown actions are:
</p>
136 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
137 <p class=
"p6"><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>
138 <p class=
"p6"><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>value +
1<span class=
"Apple-tab-span"> </span>with action
<span class=
"Apple-tab-span"> </span>space
</p>
139 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>\r
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>enterKeyAction
</p>
140 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>\n,
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>enterKeyAction
<span class=
"Apple-tab-span"> </span></p>
141 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>3.asAscii,
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>enterKeyAction
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(enter key or cmd-C on Mac OSX )
</p>
142 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>unicode
16rF700,
<span class=
"Apple-tab-span"> </span>value -
1 with action
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>up arrow
</p>
143 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>unicode
16rF703,
<span class=
"Apple-tab-span"> </span>value +
1 with action
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>right arrow
</p>
144 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>unicode
16rF701,
<span class=
"Apple-tab-span"> </span>value +
1 with action
<span class=
"Apple-tab-span"> </span>down arrow
</p>
145 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>unicode
16rF702,
<span class=
"Apple-tab-span"> </span>value -
1 with action
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>left arrow
</p>
146 <p class=
"p7"><br></p>
147 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>properties
</b></p>
148 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
149 <p class=
"p6"><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=
"s7">SCView
</span></a>.
</p>
150 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
151 <p class=
"p14"><span class=
"s1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>returns:
</p>
152 <p class=
"p16"><span class=
"s12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s4">[
</span>\bounds
<span class=
"s4">,
</span>\visible
<span class=
"s4">,
</span>\enabled
<span class=
"s4">,
</span>\canFocus
<span class=
"s4">,
</span>\resize
<span class=
"s4">,
</span>\background
<span class=
"s4">,
</span>\minWidth
<span class=
"s4">,
</span>\maxWidth
<span class=
"s4">,
</span>\minHeight
<span class=
"s4">,
</span>\maxHeight
<span class=
"s4">,
</span>\value
<span class=
"s4">,
</span>\font
<span class=
"s4">,
</span>\items
<span class=
"s4">,
</span>\stringColor
<span class=
"s4">,
</span>\align
<span class=
"s4">,
</span>\itemColors
<span class=
"s4">,
</span>\focusColor
<span class=
"s4"> ]
</span></p>
153 <p class=
"p7"><br></p>
154 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>init (argParent, argBounds)
</b></p>
155 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
156 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Overrides SCView:init.
</p>
157 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
158 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span>defaultGetDrag
</b></p>
159 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
160 <p class=
"p6"><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 SCListView. Returns the same as
<b>value
</b>.
</p>
161 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
162 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>defaultCanReceiveDrag
</b></p>
163 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
164 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The method called by default when attempting to drop a drag in this object. Returns the result of
<b>currentDrag
</b>.isNumber.
</p>
165 <p class=
"p7"><span class=
"s1"><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>
166 <p class=
"p6"><span class=
"Apple-tab-span"> </span><b>defaultReceiveDrag
</b></p>
167 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
168 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>The default method called when a drag has been recieved. Performs
<b>valueAction_
</b> with the
<b>currentDrag
</b> as an argument.
</p>
169 <p class=
"p7"><br></p>
170 <p class=
"p13"><b>Examples
</b></p>
171 <p class=
"p17"><br></p>
173 <p class=
"p17"><br></p>
174 <p class=
"p11">w =
<span class=
"s8">Window
</span>.new.front;
</p>
175 <p class=
"p17"><br></p>
176 <p class=
"p11">v =
<span class=
"s8">ListView
</span>(w,
<span class=
"s8">Rect
</span>(
10,
10,
120,
70))
</p>
177 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span>.items_([
</span>"SinOsc"<span class=
"s4">,
</span>"Saw"<span class=
"s4">,
</span>"LFSaw"<span class=
"s4">,
</span>"WhiteNoise"<span class=
"s4">,
</span>"PinkNoise"<span class=
"s4">,
</span>"BrownNoise"<span class=
"s4">,
</span>"Osc"<span class=
"s4"> ])
</span></p>
178 <p class=
"p11"><span class=
"Apple-tab-span"> </span>.background_(
<span class=
"s8">Color
</span>.clear)
</p>
179 <p class=
"p11"><span class=
"Apple-tab-span"> </span>.hiliteColor_(
<span class=
"s8">Color
</span>.green(alpha:
0.6))
</p>
180 <p class=
"p11"><span class=
"Apple-tab-span"> </span>.action_({
<span class=
"s8">arg
</span> sbs;
</p>
181 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[sbs.value, v.items[sbs.value]].postln;
<span class=
"Apple-tab-span"> </span><span class=
"s13">// .value returns the integer
</span></p>
182 <p class=
"p11"><span class=
"Apple-tab-span"> </span>});
</p>
184 <p class=
"p17"><br></p>
185 <p class=
"p17"><br></p>
186 <p class=
"p18">// Sound example use to switch Filters
</p>
188 <p class=
"p11"><span class=
"s8">Server
</span>.default = s =
<span class=
"s8">Stethoscope
</span>.defaultServer.boot;
</p>
189 <p class=
"p11">s.waitForBoot({
</p>
190 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"s8">var
</span> f, freq, ww;
</p>
191 <p class=
"p11"><span class=
"Apple-tab-span"> </span>n={r=
<span class=
"s8">LFSaw
</span>.ar([
220,
530],
0,
0.3)*
<span class=
"s8">LFPulse
</span>.ar(
12,
0,
0.3,
0.4); [r[
0],
<span class=
"s8">Delay2
</span>.ar(r[
1])]}.play;
</p>
192 <p class=
"p11"><span class=
"Apple-tab-span"> </span>freq={
<span class=
"s8">SinOsc
</span>.kr(
0.5,
0,
4000,
4200)}.play;
</p>
193 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w=
<span class=
"s8">Window
</span>(
<span class=
"s14">"Filters"</span>).front;
</p>
194 <p class=
"p11"><span class=
"Apple-tab-span"> </span>v =
<span class=
"s8">ListView
</span>(w,
<span class=
"s8">Rect
</span>(
10,
10,
180,
120))
</p>
195 <p class=
"p12"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.items_([
</span>"No Filter"<span class=
"s4">,
</span>"RLPF"<span class=
"s4">,
</span>"RHPF"<span class=
"s4">,
</span>"BPF"<span class=
"s4">,
</span>"Resonz"<span class=
"s4">,
</span>"MoogFF"<span class=
"s4"> ])
</span></p>
196 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.background_(
<span class=
"s8">Color
</span>.clear)
</p>
197 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.hiliteColor_(
<span class=
"s8">Color
</span>.green(alpha:
0.6))
</p>
198 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({
<span class=
"s8">arg
</span> v;
</p>
199 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>v.value.switch(
</p>
200 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,{try{f.free};
<span class=
"s14">"test"</span>.postln},
</p>
201 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1,{try{f.free};f={
<span class=
"s8">ReplaceOut
</span>.ar(
0,
<span class=
"s8">RLPF
</span>.ar(
<span class=
"s8">In
</span>.ar(
0,
2),
<span class=
"s8">In
</span>.kr(
0,
1),
0.2,
0.3))}.play(addAction:
<span class=
"s15">\addToTail
</span>)},
</p>
202 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2,{try{f.free};f={
<span class=
"s8">ReplaceOut
</span>.ar(
0,
<span class=
"s8">RHPF
</span>.ar(
<span class=
"s8">In
</span>.ar(
0,
2),
<span class=
"s8">In
</span>.kr(
0,
1),
0.2,
0.3))}.play(addAction:
<span class=
"s15">\addToTail
</span>)},
</p>
203 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>3,{try{f.free};f={
<span class=
"s8">ReplaceOut
</span>.ar(
0,
<span class=
"s8">BPF
</span>.ar(
<span class=
"s8">In
</span>.ar(
0,
2),
<span class=
"s8">In
</span>.kr(
0,
1),
0.2,
1.5))}.play(addAction:
<span class=
"s15">\addToTail
</span>)},
</p>
204 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>4,{try{f.free};f={
<span class=
"s8">ReplaceOut
</span>.ar(
0,
<span class=
"s8">Resonz
</span>.ar(
<span class=
"s8">In
</span>.ar(
0,
2),
<span class=
"s8">In
</span>.kr(
0,
1),
0.2,
2))}.play(addAction:
<span class=
"s15">\addToTail
</span>)},
</p>
205 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>5,{try{f.free};f={
<span class=
"s8">ReplaceOut
</span>.ar(
0,
<span class=
"s8">MoogFF
</span>.ar(
<span class=
"s8">In
</span>.ar(
0,
2),
<span class=
"s8">In
</span>.kr(
0,
1),
1.5))}.play(addAction:
<span class=
"s15">\addToTail
</span>)}
</p>
206 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
207 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
208 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
209 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
210 <p class=
"p11"><span class=
"Apple-tab-span"> </span>ww=
<span class=
"s8">FreqScope
</span>.new(
400,
200,
0);
</p>
211 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w.bounds=
<span class=
"s8">Rect
</span>(
50,
<span class=
"s8">Window
</span>.screenBounds.height-
300,
200,
200);
</p>
212 <p class=
"p11"><span class=
"Apple-tab-span"> </span>ww.window.bounds=ww.window.bounds.moveTo(
255,
<span class=
"s8">Window
</span>.screenBounds.height-
328);
</p>
213 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"s8">CmdPeriod
</span>.doOnce({{ww.window.close}.defer(
0.5);w.close;});
</p>
214 <p class=
"p18"><span class=
"s4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//defer or crash, because FreqScopeWindow Class contains its own routine for cleaning up on CmdPeriod
</p>
215 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w.onClose_({n.free;f.free;freq.free});
</p>
216 <p class=
"p11">});
</p>
218 <p class=
"p17"><br></p>