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=
"1038.29">
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: #0023e6}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #2b30fa}
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 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #961e1e}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.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 85.0px; text-indent: -85.0px; font: 12.0px Helvetica
; min-height: 14.0px}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #cd0b0b}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #cd0b0b}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #2024c7}
28 span
.s1
{font: 18.0px Helvetica
}
29 span
.s2
{color: #000000}
30 span
.s3
{text-decoration: underline
; color: #0018ea}
31 span
.s4
{color: #0026f7}
32 span
.s5
{text-decoration: underline
; color: #0023e6}
33 span
.s6
{text-decoration: underline
}
34 span
.s7
{color: #0023e6}
35 span
.s8
{text-decoration: underline
; color: #2b30fa}
36 span
.s9
{color: #001db9}
37 span
.s10
{color: #426f0e}
38 span
.s11
{color: #961e1e}
39 span
.s12
{color: #2024c7}
40 span
.s13
{color: #008417}
41 span
.s14
{color: #737373}
42 span
.Apple-tab-span
{white-space:pre
}
46 <p class=
"p1"><span class=
"s1"><b>EnvirGui
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>display the contents of an environment for editing
</b></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p1"><b>Inherits from: JITGui
</b></p>
49 <p class=
"p3"><br></p>
50 <p class=
"p1">EnvirGui displays all keys and values of an environment, so one can change them flexibly.
<span class=
"Apple-converted-space"> </span></p>
51 <p class=
"p1">Single number get displayed with an EZSlider, pairs of numbers with an EZRanger,
<span class=
"Apple-converted-space"> </span></p>
52 <p class=
"p1">and anything else is shown as an EZText (a text field).
</p>
53 <p class=
"p2"><br></p>
54 <p class=
"p4"><span class=
"s2"><b>See also:
</b> <a href=
"adclib/EZText.html"><span class=
"s3">EZText
</span></a></span><span class=
"s4">,
<a href=
"SC://TdefEditor"><span class=
"s5">Tdef
</span></a></span><span class=
"s6">Gui
</span><span class=
"s4">,
<a href=
"SC://PdefEditor"><span class=
"s5">Pdef
</span></a></span><span class=
"s6">Gui,
</span></p>
55 <p class=
"p5"><span class=
"s7"><span class=
"Apple-tab-span"> </span><a href=
"NPParamGui.html"><span class=
"s8">NPParamGui
</span></a></span></p>
56 <p class=
"p2"><br></p>
57 <p class=
"p2"><br></p>
58 <p class=
"p6"><b>Creation / Class Methods
</b></p>
59 <p class=
"p7"><br></p>
60 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*new (object, numItems, parent, bounds, extras, makeSkip)
</b></p>
61 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b></p>
62 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>create a new EnvirGui
</p>
63 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>object
</b>- the envir to display
</p>
64 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>numItems
</b>- the number of items to display. If an envir is given, and no num, num is envir.size.
</p>
65 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>parent
</b>- the parent view to display in; if none is given, a new window is created.
<span class=
"Apple-converted-space"> </span></p>
66 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>bounds
</b>- the bounds within which to display; if none is given, bounds are calculated.
</p>
67 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>name
</b>- a name to use for the envir/gui; is used for the auto-created window.
</p>
68 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>makeSkip
</b>- flag whether to make a skipjack to manage updates of the envirgui. default is true.
</p>
69 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
70 <p class=
"p11"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// simple example
</p>
71 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s9">EnvirGui
</span>.new(nil,
5);
<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>// empty with
5 slots
</p>
72 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.object_((a:
1, b:
<span class=
"s10">\werty
</span>, freq: [
500,
2000]));
<span class=
"Apple-tab-span"> </span><span class=
"s11">// put some things in
</span></p>
73 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.put(
<span class=
"s10">\karl
</span>,
<span class=
"s10">\otto1
</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=
"Apple-tab-span"> </span>// one more
</p>
74 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.putAll((b: -
12, r:
1, s:
2, t:
3, u:
4, v:
5))
<span class=
"Apple-converted-space"> </span></p>
75 <p class=
"p7"><br></p>
76 <p class=
"p11"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.object_((x:
2));
<span class=
"Apple-tab-span"> </span></span>// put something else in
</p>
77 <p class=
"p7"><br></p>
78 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.putAll((b: -
12, r:
1, s:
2, t:
3, u:
4, v:
5))
<span class=
"Apple-converted-space"> </span></p>
79 <p class=
"p7"><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>
80 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\b)
</p>
81 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\r)
<span class=
"Apple-converted-space"> </span></p>
82 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\s)
<span class=
"Apple-converted-space"> </span></p>
83 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\t)
<span class=
"Apple-converted-space"> </span></p>
84 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\u)
<span class=
"Apple-converted-space"> </span></p>
85 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.removeAt(\v)
<span class=
"Apple-converted-space"> </span></p>
86 <p class=
"p7"><br></p>
87 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.parent.close;
</p>
88 <p class=
"p9"><br></p>
89 <p class=
"p9"><br></p>
90 <p class=
"p13"><b>Instance Variables
<span class=
"Apple-converted-space"> </span></b></p>
91 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
92 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>numItems
<span class=
"Apple-tab-span"> </span></b>how many envir items to display
<span class=
"Apple-converted-space"> </span></p>
93 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
94 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>envir
<span class=
"Apple-tab-span"> </span></b>the envir displayed - actually an alias for object.
</p>
95 <p class=
"p9"><br></p>
96 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>zone
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>the composite view the envirgui makes for itself
<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>
97 <p class=
"p9"><br></p>
98 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>valFields
</b><span class=
"Apple-tab-span"> </span>the areas in which the key-value pairs are displayed.
</p>
99 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
100 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>widgets
</b><span class=
"Apple-tab-span"> </span>the EZGuis that display the values:
<span class=
"Apple-converted-space"> </span></p>
101 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Single numbers will have an EZSlider,
<span class=
"Apple-converted-space"> </span></p>
102 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>pairs of numbers will be shown as an EZRanger,
<span class=
"Apple-converted-space"> </span></p>
103 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>all other values are shown as compileStrings in an EZText.
</p>
104 <p class=
"p9"><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></p>
105 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>specs
</b><span class=
"Apple-tab-span"> </span>EZSlider and EZRanger needs specs for their display ranges;
</p>
106 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if there is a global spec for that key (key.asSpec), it will be used.
<span class=
"Apple-converted-space"> </span></p>
107 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>If not, a spec is generated (see the getSpec method) and kept in these (local) specs.
<span class=
"Apple-converted-space"> </span><b><span class=
"Apple-tab-span"> </span></b></p>
108 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
109 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>keysRotation
<span class=
"Apple-tab-span"> </span></b></p>
110 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if the size of envir exceeds numItems, the keys displayed can be rotated:
<span class=
"Apple-converted-space"> </span></p>
111 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>e.g. with
10 keys displayed on
5 valFields,
<span class=
"Apple-converted-space"> </span></p>
112 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>keysRotation
0 means show keys (
0.
.4),
<span class=
"Apple-converted-space"> </span></p>
113 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>keysRotation
2 means show keys (
2.
.6), etc.
</p>
114 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></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><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
115 <p class=
"p9"><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>
116 <p class=
"p13"><b>Some Methods
</b></p>
117 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
118 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>object_ (obj)
<span class=
"Apple-tab-span"> </span></b>set the environment to show
</p>
119 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b></p>
120 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>obj
</b>- can be nil, a dictionary, an environment, or an event.
</p>
121 <p class=
"p14"><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>
122 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s12">EnvirGui
</span>((freq:
120,
<span class=
"s13">\amp
</span>:
0.2,
<span class=
"s13">\pan
</span>: -
0.5),
12,
<span class=
"s12">nil
</span>, bounds:
<span class=
"s12">Rect
</span>(
20,
400,
220,
100));
<span class=
"Apple-converted-space"> </span></p>
123 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.object_((a:
1, b: [
2,
3], c:
<span class=
"s13">\symbol
</span>, d: [
4,
5,
6], f: {
<span class=
"s14">"boing"</span>.postln }))
</p>
124 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
125 <p class=
"p8"><span class=
"Apple-tab-span"> </span><b>envir_(envir)
<span class=
"Apple-tab-span"> </span></b>same as object_(obj)
</p>
126 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
127 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>name_ (name)
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>if in its own window, set the window's name
</p>
128 <p class=
"p9"><br></p>
129 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.name_(
<span class=
"s14">"Yoohoo")
</span>;
</p>
130 <p class=
"p2"><br></p>
131 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>getSpec (key, value)
</b></p>
132 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b></p>
133 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>For editing, specs for the parameter ranges are needed.
<span class=
"Apple-converted-space"> </span></p>
134 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>These can be set locally in the EnvirGui, or global specs will be looked up.
</p>
135 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>If no local or global specs exist for that parameter name, getSpec makes a
<span class=
"Apple-converted-space"> </span></p>
136 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>usable guess for them.
</p>
137 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>key
</b>- the parameter name for which to find a spec
</p>
138 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>value
</b>- the current value of that param, which may be used for guessing specs.
</p>
139 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
140 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// inline example
</p>
141 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s12">EnvirGui
</span>.new;
</p>
142 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.getSpec(
</span><span class=
"s13">\freq
</span><span class=
"s2">,
400);
</span>// \freq exists as global spec, so use that
</p>
143 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.object_((freq:
150));
</p>
144 <p class=
"p7"><br></p>
145 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.getSpec(
</span><span class=
"s13">\iFrek
</span><span class=
"s2">,
500);
<span class=
"Apple-tab-span"> </span></span>// no global spec, so make a new one:
</p>
146 <p class=
"p15"><span class=
"s2"><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=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// exponential from val *
0.05 to val *
20;
<span class=
"Apple-converted-space"> </span></p>
147 <p class=
"p15"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.specs;
<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>// and keep it here
</p>
148 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.envir.put(
<span class=
"s13">\iFrek
</span>,
500);
</p>
149 <p class=
"p9"><br></p>
150 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>putSpec (key, obj)
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>add a spec for a given key,
<span class=
"Apple-converted-space"> </span></p>
151 <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>or (if it is a global key) override a global spec with a local one:
<span class=
"Apple-converted-space"> </span></p>
152 <p class=
"p9"><span class=
"Apple-tab-span"> </span></p>
153 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.putSpec(
<span class=
"s13">\iFrek
</span>, [
10,
1000,
<span class=
"s13">\exp
</span>]);
<span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span></span></p>
154 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.putSpec(
<span class=
"s13">\freq
</span>, [
100,
1000,
<span class=
"s13">\exp
</span>]);
<span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span></span></p>
155 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.object_((freq:
200, iFrek:
20));
</p>
156 <p class=
"p9"><br></p>
157 <p class=
"p9"><br></p>
158 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Some internal methods:
</b></p>
159 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span></b></p>
160 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>setField (index, key, value, sameKey)
</b></p>
161 <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>set a field by index, with the new key, value;
<span class=
"Apple-converted-space"> </span></p>
162 <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>sameKey means the field had the same key already.
</p>
163 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>setByKeys
<span class=
"Apple-tab-span"> </span></b>update the widgets for the current keys
</p>
164 <p class=
"p7"><br></p>
165 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>clearField (index)
<span class=
"Apple-tab-span"> </span></b>remove the EZGui at this index
</p>
166 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>clearFields
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>remove all unused EZGuis
<b><span class=
"Apple-tab-span"> </span></b></p>
167 <p class=
"p7"><br></p>
168 <p class=
"p7"><br></p>
169 <p class=
"p13"><b>Examples
</b></p>
170 <p class=
"p3"><br></p>
171 <p class=
"p3"><br></p>
172 <p class=
"p16"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// Setting envir variables in a Tdef:
</p>
174 <p class=
"p17"><span class=
"s12">Tdef
</span>(
<span class=
"s13">\text
</span>).set(
<span class=
"s13">\note
</span>, [
0,
2,
7],
<span class=
"s13">\dur
</span>, { [
0.1,
0.2,
0.4].choose },
<span class=
"s13">\pan
</span>,
0,
<span class=
"s13">\amp
</span>,
0.1);
</p>
175 <p class=
"p3"><br></p>
176 <p class=
"p17">w =
<span class=
"s12">Window
</span>(
<span class=
"s14">"EZTexts"</span>,
<span class=
"s12">Rect
</span>(
200,
400,
304,
120)).front;
</p>
177 <p class=
"p17">w.addFlowLayout;
</p>
178 <p class=
"p3"><br></p>
179 <p class=
"p17"><span class=
"s12">TdefGui
</span>(
<span class=
"s12">Tdef
</span>(
<span class=
"s13">\text
</span>),
0, parent: w);
</p>
180 <p class=
"p3"><br></p>
181 <p class=
"p17">e =
<span class=
"s12">EnvirGui
</span>(
<span class=
"s12">Tdef
</span>(
<span class=
"s13">\text
</span>).envir,
4, parent: w);
</p>
182 <p class=
"p3"><br></p>
183 <p class=
"p18">Tdef
<span class=
"s2">(
</span><span class=
"s13">\text
</span><span class=
"s2">, {
</span>|ev|
<span class=
"s2"><span class=
"Apple-converted-space"> </span></span></p>
184 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"s12">var
</span> mydur;
</p>
185 <p class=
"p17"><span class=
"Apple-tab-span"> </span>loop {
<span class=
"Apple-converted-space"> </span></p>
186 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>mydur = ev.dur;
</p>
187 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(note: ev.note, dur: mydur, amp: ev.amp, pan: ev.pan).postln.play;
</p>
188 <p class=
"p17"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>mydur.wait;
</p>
189 <p class=
"p17"><span class=
"Apple-tab-span"> </span>}
</p>
190 <p class=
"p17">}).play;
</p>
192 <p class=
"p3"><br></p>
193 <p class=
"p16"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// or equivalently, use the built-in EnvirGui in TdefGui:
</p>
194 <p class=
"p18">TdefGui
<span class=
"s2">(
</span>Tdef
<span class=
"s2">(
</span><span class=
"s13">\text
</span><span class=
"s2">),
4);
</span></p>
195 <p class=
"p3"><br></p>
196 <p class=
"p17"><span class=
"s12">Tdef
</span>(
<span class=
"s13">\text
</span>).set(
<span class=
"s13">\yuhu
</span>,
<span class=
"s12">Prand
</span>([
2,
3,
5,
8,
13],
<span class=
"s12">inf
</span>),
<span class=
"s13">\magic
</span>, [
<span class=
"s13">\abra
</span>,
<span class=
"s13">\cadabra
</span>]);
</p>
197 <p class=
"p3"><br></p>
198 <p class=
"p17"><span class=
"s12">Tdef
</span>(
<span class=
"s13">\text
</span>).clear;
</p>