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.54">
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: #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: 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 57.0px; text-indent: -57.0px; font: 9.0px Monaco
}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #606060}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco
; color: #bf0000}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.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
}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
26 span
.s1
{font: 18.0px Helvetica
}
27 span
.s2
{color: #0000bf}
28 span
.s3
{color: #000000}
29 span
.s4
{text-decoration: underline
}
30 span
.s5
{font: 11.0px Monaco
}
31 span
.s6
{color: #007300}
32 span
.s7
{color: #606060}
33 span
.s8
{color: #bf0000}
34 span
.Apple-tab-span
{white-space:pre
}
38 <p class=
"p1"><span class=
"s1"><b>EZPopUpMenu
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>a wrapper class for a label plus a popUpMenu with per item actions
</b><span class=
"s1"><b><span class=
"Apple-tab-span"> </span></b></span></p>
39 <p class=
"p2"><br></p>
40 <p class=
"p1"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><span class=
"s2"><b>Object
</b></span></a><b> :
</b><a href=
"EZGui.html"><span class=
"s2"><b>EZGui
</b></span></a><b> :
</b><a href=
"EZLists.html"><span class=
"s2"><b>EZLists
</b></span></a></p>
41 <p class=
"p3"><br></p>
42 <p class=
"p1">EZPopUpMenu is wrapper class which creates an (optional) label and a popUpMenu. It includes per item actions as well as a global action which are both evaluated upon selection of an item. Convenience methods for inserting and deleting menu items are also included . If the parent is nil, then EZPopUpMenu will create its own window.See
<a href=
"EZGui.html"><span class=
"s2">EZGui
</span></a> and
<a href=
"EZLists.html"><span class=
"s2">EZLists
</span></a> for all of the options.
</p>
43 <p class=
"p2"><br></p>
44 <p class=
"p4"><span class=
"s3"><b>See also:
</b> <a href=
"../Cocoa-GUI/SCPopUpMenu.html"><span class=
"s4">SCPopUpMenu
</span></a></span></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p5"><b>Some Important Issues Regarding EZPopUpMenu
</b></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p1">The convenience methods for EZPopUpMenu require that the items array is an array of associations of labels and functions, not like in
<a href=
"../Cocoa-GUI/SCPopUpMenu.html"><span class=
"s2">SCPopUpMenu
</span></a>, where items is simply an array of strings. If
<b>label
</b> is nil, then no staticText is created. I
</p>
49 <p class=
"p2"><br></p>
50 <p class=
"p5"><b>Creation / Class Methods
</b></p>
51 <p class=
"p6"><br></p>
52 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>*new (parentView, bounds, label, items, globalAction, initVal, initAction, labelWidth, labelHeight,layout,gap)
</b></p>
53 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
54 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>parentView
</b>- The parent view or window. If the parent is nil, then EZPopUpMenu will create its own
<a href=
"../Main-GUI/Window.html"><span class=
"s2">Window
</span></a>, and place it conveniently on the screen if the bounds are a
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>. If the bounds are a
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>, then the Rect determines the window bounds.
</p>
55 <p class=
"p10"><br></p>
56 <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=
"s2">Rect
</span></a> or
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>. Default value is
<span class=
"s5">160@
22</span>.
</p>
57 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>label
</b>- the label. Default value is nil. If nil, then no SCStaticText is created.
<span class=
"Apple-converted-space"> </span></p>
58 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>items
</b>- Default value is nil. An Array of
<a href=
"../../Collections/Association.html"><span class=
"s2">Association
</span></a>s ['label' -
> {arg menuObj; value}, ]. Or and Array Symbols (if you are only using
<b>globalAction
</b>).
</p>
59 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>globalAction
</b>- a Global function to be performed in addition to the item functions {arg menuObj; value}.
</p>
60 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>initVal
</b>- Initial
<b>value
</b> of the Menu, i.e. the index selected. Default value is
0.
</p>
61 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>initAction
</b>- An instance of
<a href=
"../../Core/Boolean.html"><span class=
"s2">Boolean
</span></a>. Performs the action at
<b>initVal
</b> on creation of the menu, plus the
<b>globalAction
</b>. Default value is false.
</p>
62 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>labelWidth
</b>- Default value is
80.
</p>
63 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>labelHeight
</b>- Default value is
20. Not used if
<b>layout
</b> is \horz.
</p>
64 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>layout
</b>- \vert or \horz. default is horz;
</p>
65 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>gap
</b>- A
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>. By default, the view tries to get its parent's gap, otherwise it defaults to
2@
2. Setting it overrides these.
</p>
66 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>margin
</b>- A
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>. This will inset the bounds occupied
<span class=
"Apple-converted-space"> </span>by the subviews of view.
</p>
67 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
68 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
69 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w=
<span class=
"s2">Window
</span>.new.front;
</p>
70 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.decorator =
<span class=
"s2">FlowLayout
</span>(w.view.bounds);
</p>
71 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s2">EZPopUpMenu
</span>.new(w,
</p>
72 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>230@
22,
</p>
73 <p class=
"p12"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"A PopUpMenu: "<span class=
"s3">,
</span></p>
74 <p class=
"p11"><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>
75 <p class=
"p11"><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=
"s6">\item0
</span> -
>{
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 0 of "</span> ++ a).postln},
</p>
76 <p class=
"p11"><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=
"s6">\item1
</span> -
>{
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 1 of "</span> ++ a).postln},
</p>
77 <p class=
"p11"><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=
"s6">\item2
</span> -
>{
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 2 of "</span> ++ a).postln},
</p>
78 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>],
</p>
79 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>globalAction: {
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is a global action of "</span>++a.asString ).postln},
</p>
80 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>initVal:
1,
</p>
81 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>initAction:
<span class=
"s2">true
</span>,
</p>
82 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>labelWidth:
120,
</p>
83 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>labelHeight:
20,
</p>
84 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>layout:
<span class=
"s6">\horz
</span>,
</p>
85 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>gap:
2@
2</p>
86 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
87 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
88 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
89 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
90 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// or a more simple syntax:
</p>
91 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
92 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w=
<span class=
"s2">Window
</span>.new.front;
</p>
93 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.decorator =
<span class=
"s2">FlowLayout
</span>(w.view.bounds);
</p>
94 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g =
<span class=
"s2">EZPopUpMenu
</span>.new(w,
200@
22,
<span class=
"s7">"Menu: "</span>);
</p>
95 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 0 of "</span> ++ a).postln});
</p>
96 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 1 of "</span> ++ a).postln});
</p>
97 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s2">|a|
</span> (
<span class=
"s7">"this is item 2 of "</span> ++ a).postln});
</p>
98 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>g.value=
0;
</p>
99 <p class=
"p14"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
100 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
101 <p class=
"p15"><b>Changing Appearance
</b></p>
102 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
103 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>setColors(stringBackground,stringColor,menuBackground,menuStringColor,background)
</b></p>
104 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b></p>
105 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>stringBackground
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>. The
<b>background
</b> of the label and unit views.
</p>
106 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>stringColor
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>. The
<b>stringColor
</b> of the label and unit views.
</p>
107 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>menuBackground
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>. The
<b>background
</b> of the menu.
</p>
108 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>menuStringColor
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>. The
<b>stringColor
</b> of the menu.
</p>
109 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>background
</b>- An instance of
<a href=
"../GUI-Tools/Color.html"><span class=
"s2">Color
</span></a>. The
<b>backround
</b> of the list view.
</p>
110 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
111 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span>font_(font)
</b></p>
112 <p class=
"p7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Set the Font used by all the views.
</p>
113 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>font
</b>- An instance of
<a href=
"../Main-GUI/Font.html"><span class=
"s2">Font
</span></a>.
<span class=
"Apple-converted-space"> </span></p>
114 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
115 <p class=
"p5"><b>Examples
</b></p>
116 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
117 <p class=
"p16">// try several examples together
</p>
119 <p class=
"p3"><br></p>
120 <p class=
"p16">// many menus
</p>
121 <p class=
"p16">// inherits the parent's decorator gap
</p>
122 <p class=
"p3"><br></p>
124 <p class=
"p11">w=
<span class=
"s2">Window
</span>.new(
<span class=
"s7">"oscillators"</span>,
<span class=
"s2">Rect
</span>(
200,
500,
200,
160)).front;
</p>
125 <p class=
"p11">w.view.decorator =
<span class=
"s2">FlowLayout
</span>(w.view.bounds).gap_(
2@
2);
</p>
126 <p class=
"p11">5.do{
<span class=
"s2">|i|
</span></p>
127 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g =
<span class=
"s2">EZPopUpMenu
</span>.new(w,
190@
22,
<span class=
"s7">"Oscillator % : "</span>.format(i+
1));
</p>
128 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\off
</span>, {
<span class=
"s7">"off"</span>. postln});
</p>
129 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\sine
</span>, {
<span class=
"s7">"sine"</span>. postln});
</p>
130 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\saw
</span>, {
<span class=
"s7">"saw"</span>. postln});
</p>
131 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.addItem(
<span class=
"s6">\pulse
</span>, {
<span class=
"s7">"pulse"</span>. postln});
</p>
132 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.setColors(
<span class=
"s2">Color
</span>.grey,
<span class=
"s2">Color
</span>.white);
</p>
133 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.value=
0;
</p>
134 <p class=
"p11">};
</p>
135 <p class=
"p11">w.bounds=w.bounds.moveBy(
300,
60);
</p>
136 <p class=
"p14">);
</p>
137 <p class=
"p2"><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>
138 <p class=
"p2"><br></p>
139 <p class=
"p13">// Creates its own window if parentView is nil:
</p>
141 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(
<span class=
"s2">nil
</span>,
250@
22 ,
<span class=
"s7">" Select : "</span>);
</p>
142 <p class=
"p11">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
143 <p class=
"p11">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
144 <p class=
"p11">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
145 <p class=
"p11">g.setColors(
<span class=
"s2">Color
</span>.grey,
<span class=
"s2">Color
</span>.white);
</p>
146 <p class=
"p11">g.value=
0;
</p>
147 <p class=
"p6"><br></p>
148 <p class=
"p14">);
</p>
149 <p class=
"p3"><br></p>
150 <p class=
"p16">// layout vertical:
</p>
152 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(
<span class=
"s2">nil
</span>,
200@
42,
<span class=
"s7">" Choose"</span>,layout:
<span class=
"s6">\vert
</span>);
</p>
153 <p class=
"p11">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
154 <p class=
"p11">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
155 <p class=
"p11">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
156 <p class=
"p11">g.setColors(
<span class=
"s2">Color
</span>.grey,
<span class=
"s2">Color
</span>.white);
</p>
157 <p class=
"p11">g.window.bounds=g.window.bounds.moveBy(
300,-
200);
</p>
158 <p class=
"p11">g.value=
0;
</p>
159 <p class=
"p14">);
</p>
160 <p class=
"p3"><br></p>
161 <p class=
"p16">// No labelView created, so set the window title;
</p>
163 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(bounds:
180@
22);
<span class=
"s8">// no label
</span></p>
164 <p class=
"p11">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
165 <p class=
"p11">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
166 <p class=
"p11">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
167 <p class=
"p11">g.value=
0;
</p>
168 <p class=
"p11">g.window.name=
<span class=
"s7">" choose item"</span>;
</p>
169 <p class=
"p11">g.window.bounds=g.window.bounds.moveBy(
0,-
200);
</p>
170 <p class=
"p14">);
</p>
172 <p class=
"p16">// insertItem;
</p>
173 <p class=
"p6"><br></p>
175 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(
<span class=
"s2">nil
</span>,
200@
22,
<span class=
"s7">"Menu:"</span>);
</p>
176 <p class=
"p11">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
177 <p class=
"p11">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
178 <p class=
"p14">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
179 <p class=
"p14">g.addItem(
<span class=
"s6">\item4
</span>, {
<span class=
"s7">"this is item 4"</span>. postln});
</p>
180 <p class=
"p11">g.value=
0;
</p>
181 <p class=
"p14">);
</p>
182 <p class=
"p3"><br></p>
183 <p class=
"p14">g.insertItem(
3,
<span class=
"s6">\item3
</span>, {
<span class=
"s7">"this is item 3"</span>. postln});
</p>
184 <p class=
"p3"><br></p>
185 <p class=
"p3"><br></p>
186 <p class=
"p13">// remove Item ;
</p>
187 <p class=
"p6"><br></p>
189 <p class=
"p11">w=
<span class=
"s2">Window
</span>.new.front;
</p>
190 <p class=
"p11">w.view.decorator =
<span class=
"s2">FlowLayout
</span>(w.view.bounds);
</p>
191 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(w,
200@
22,
<span class=
"s7">"Menu:"</span>);
</p>
192 <p class=
"p11">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
193 <p class=
"p11">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
194 <p class=
"p14">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
195 <p class=
"p14">g.addItem(
<span class=
"s6">\item4
</span>, {
<span class=
"s7">"this is item 4"</span>. postln});
</p>
196 <p class=
"p14">g.insertItem(
3,
<span class=
"s6">\item3
</span>, {
<span class=
"s7">"this is item 3"</span>. postln});
</p>
197 <p class=
"p11">g.value=
0;
</p>
199 <p class=
"p3"><br></p>
200 <p class=
"p14">g. removeItemAt(
0);
</p>
201 <p class=
"p3"><br></p>
202 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
203 <p class=
"p8"><br></p>
204 <p class=
"p13">// replace item;
</p>
206 <p class=
"p11">g =
<span class=
"s2">EZPopUpMenu
</span>.new(
<span class=
"s2">nil
</span>,
200@
22,
<span class=
"s7">"List:"</span>);
</p>
207 <p class=
"p14">g.addItem(
<span class=
"s6">\item0
</span>, {
<span class=
"s7">"this is item 0"</span>. postln});
</p>
208 <p class=
"p14">g.addItem(
<span class=
"s6">\item1
</span>, {
<span class=
"s7">"this is item 1"</span>. postln});
</p>
209 <p class=
"p14">g.addItem(
<span class=
"s6">\item2
</span>, {
<span class=
"s7">"this is item 2"</span>. postln});
</p>
210 <p class=
"p14">g.addItem(
<span class=
"s6">\item3
</span>, {
<span class=
"s7">"this is item 3"</span>. postln});
</p>
212 <p class=
"p3"><br></p>
213 <p class=
"p14">g.replaceItemAt(
2,
<span class=
"s6">\item2_replaced
</span>, {
<span class=
"s7">"this is item 2 replaced"</span>. postln});
</p>
214 <p class=
"p3"><br></p>
215 <p class=
"p8"><br></p>