1 |
578 |
markom |
<HTML>
|
2 |
|
|
<HEAD>
|
3 |
|
|
<TITLE>iwidgets2.2.0 User Commands - optionmenu</TITLE>
|
4 |
|
|
</HEAD>
|
5 |
|
|
<BODY BGCOLOR="#FFFFFF">
|
6 |
|
|
<H1>iwidgets2.2.0 User Commands - optionmenu</H1>
|
7 |
|
|
<HR>
|
8 |
|
|
<PRE>
|
9 |
|
|
|
10 |
|
|
</PRE>
|
11 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
</PRE>
|
15 |
|
|
<H2>NAME</H2><PRE>
|
16 |
|
|
optionmenu - Create and manipulate a option menu widget
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
</PRE>
|
20 |
|
|
<H2>SYNOPSIS</H2><PRE>
|
21 |
|
|
<STRONG>optionmenu</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
</PRE>
|
25 |
|
|
<H2>INHERITANCE</H2><PRE>
|
26 |
|
|
itk::Widget <- Labeledwidget <- optionmenu
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
</PRE>
|
30 |
|
|
<H2>STANDARD OPTIONS</H2><PRE>
|
31 |
|
|
<STRONG>activeBackground</STRONG> <STRONG>activeBorderWidthactiveForegroundbackground</STRONG>
|
32 |
|
|
<STRONG>borderWidth</STRONG> <STRONG>cursor</STRONG> <STRONG>disabledForegroundfont</STRONG>
|
33 |
|
|
<STRONG>foreground</STRONG> <STRONG>highlightColor</STRONG> <STRONG>highlightThicknessrelief</STRONG>
|
34 |
|
|
|
35 |
|
|
See the "options" manual entry for details on the standard
|
36 |
|
|
options.
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
</PRE>
|
40 |
|
|
<H2>INHERITED OPTIONS</H2><PRE>
|
41 |
|
|
<STRONG>labelBitmap</STRONG> <STRONG>labelFont</STRONG> <STRONG>labelImage</STRONG> <STRONG>labelMargin</STRONG>
|
42 |
|
|
<STRONG>labelPos</STRONG> <STRONG>labelText</STRONG> <STRONG>labelVariable</STRONG>
|
43 |
|
|
|
44 |
|
|
See the "LabeledWidget" manual entry for details on the
|
45 |
|
|
inherited options.
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
</PRE>
|
49 |
|
|
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
|
50 |
|
|
Name: <STRONG>clickTime</STRONG>
|
51 |
|
|
Class: <STRONG>ClickTime</STRONG>
|
52 |
|
|
Command-Line Switch: <STRONG>-clicktime</STRONG>
|
53 |
|
|
|
54 |
|
|
Interval time, in msec, used to determine that a single
|
55 |
|
|
mouse click has occurred. Used to post menu on a
|
56 |
|
|
"quick" mouse click. <STRONG>Note</STRONG>: changing this value may
|
57 |
|
|
cause the sigle-click functionality to not work prop-
|
58 |
|
|
erly. The default is 150 msec.
|
59 |
|
|
|
60 |
|
|
Name: <STRONG>command</STRONG>
|
61 |
|
|
Class: <STRONG>Command</STRONG>
|
62 |
|
|
Command-Line Switch: <STRONG>-command</STRONG>
|
63 |
|
|
|
64 |
|
|
Specifies a Tcl command procedure to be evaluated fol-
|
65 |
|
|
lowing a change in the current option menu selection.
|
66 |
|
|
|
67 |
|
|
Name: <STRONG>cyclicOn</STRONG>
|
68 |
|
|
Class: <STRONG>CyclicOn</STRONG>
|
69 |
|
|
Command-Line Switch: <STRONG>-cyclicon</STRONG>
|
70 |
|
|
|
71 |
|
|
Turns on/off the 3rd mouse button capability. The value
|
72 |
|
|
may be specified in any of the forms acceptable to
|
73 |
|
|
<STRONG>Tcl_GetBoolean</STRONG>. This feature allows the right mouse
|
74 |
|
|
button to cycle through the popup menu list without
|
75 |
|
|
poping it up. The right mouse button cycles through the
|
76 |
|
|
menu in reverse order. The default is true.
|
77 |
|
|
|
78 |
|
|
Name: <STRONG>items</STRONG>
|
79 |
|
|
Class: <STRONG>Items</STRONG>
|
80 |
|
|
Command-Line Switch: <STRONG>-items</STRONG>
|
81 |
|
|
|
82 |
|
|
Sepcifies the list of items to be displayed in the
|
83 |
|
|
menu.
|
84 |
|
|
|
85 |
|
|
Name: <STRONG>popupCursor</STRONG>
|
86 |
|
|
Class: <STRONG>Cursor</STRONG>
|
87 |
|
|
Command-Line Switch: <STRONG>-popupcursor</STRONG>
|
88 |
|
|
|
89 |
|
|
Specifies the mouse cursor to be used for the popup
|
90 |
|
|
menu. The value may have any of the forms acceptable
|
91 |
|
|
to <STRONG>Tk_GetCursor</STRONG>.
|
92 |
|
|
|
93 |
|
|
Name: <STRONG>state</STRONG>
|
94 |
|
|
Class: <STRONG>State</STRONG>
|
95 |
|
|
Command-Line Switch: <STRONG>-state</STRONG>
|
96 |
|
|
|
97 |
|
|
Specified one of two states for the optionmenu: <STRONG>normal</STRONG>,
|
98 |
|
|
or <STRONG>disabled</STRONG>. If the optionmenu is disabled, then
|
99 |
|
|
option menu selection is ignored.
|
100 |
|
|
|
101 |
|
|
Name: <STRONG>width</STRONG>
|
102 |
|
|
Class: <STRONG>Width</STRONG>
|
103 |
|
|
Command-Line Switch: <STRONG>-width</STRONG>
|
104 |
|
|
|
105 |
|
|
Specifies a fixed size for the menu button label in any
|
106 |
|
|
of the forms acceptable to Tk_GetPixels. If the text
|
107 |
|
|
is too small to fit in the label, the text is clipped.
|
108 |
|
|
Note: Normally, when a new list is created, or new
|
109 |
|
|
items are added to an existing list, the menu button
|
110 |
|
|
label is resized automatically. Setting this option
|
111 |
|
|
overrides that functionality.
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
</PRE>
|
115 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
</PRE>
|
120 |
|
|
<H2>DESCRIPTION</H2><PRE>
|
121 |
|
|
The <STRONG>optionmenu</STRONG> command creates an option menu widget with
|
122 |
|
|
options to manage it. An option menu displays a frame con-
|
123 |
|
|
taining a label and a button. A pop-up menu will allow for
|
124 |
|
|
the value of the button to change.
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
</PRE>
|
129 |
|
|
<H2>METHODS</H2><PRE>
|
130 |
|
|
The <STRONG>optionmenu</STRONG> command creates a new Tcl command whose name
|
131 |
|
|
is <EM>pathName</EM>. This command may be used to invoke various
|
132 |
|
|
operations on the widget. It has the following general
|
133 |
|
|
form:
|
134 |
|
|
|
135 |
|
|
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
|
136 |
|
|
|
137 |
|
|
<EM>Option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
|
138 |
|
|
mand.
|
139 |
|
|
|
140 |
|
|
Many of the widget commands for an optionmenu take as one
|
141 |
|
|
argument an indicator of which entry of the option menu to
|
142 |
|
|
operate on. These indicators are called <EM>index</EM>es and may be
|
143 |
|
|
specified in any of the following forms:
|
144 |
|
|
|
145 |
|
|
<EM>number</EM> Specifies the entry numerically, where 0
|
146 |
|
|
corresponds to the top-most entry of the option
|
147 |
|
|
menu, 1 to the entry below it, and so on.
|
148 |
|
|
|
149 |
|
|
<STRONG>end</STRONG> Indicates the bottommost entry in the menu. If
|
150 |
|
|
there are no entries in the menu then zero is
|
151 |
|
|
returned.
|
152 |
|
|
|
153 |
|
|
<STRONG>select</STRONG> Returns the numerical index of the currently
|
154 |
|
|
selected option menu entry. If no entries exist
|
155 |
|
|
in the menu, then -1 is returned.
|
156 |
|
|
|
157 |
|
|
<EM>pattern</EM> If the index doesn't satisfy one of the above
|
158 |
|
|
forms then this form is used. <EM>Pattern</EM> is
|
159 |
|
|
pattern-matched against the label of each entry
|
160 |
|
|
in the option menu, in order from the top down,
|
161 |
|
|
until a matching entry is found. The rules of
|
162 |
|
|
<STRONG>Tcl_StringMatch</STRONG> are used.
|
163 |
|
|
|
164 |
|
|
The following widget commands are possible for optionmenu
|
165 |
|
|
widgets:
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
</PRE>
|
170 |
|
|
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
|
171 |
|
|
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
|
172 |
|
|
Returns the current value of the configuration option
|
173 |
|
|
given by <EM>option</EM>. <EM>Option</EM> may have any of the values
|
174 |
|
|
accepted by the <STRONG>optionmenu</STRONG> command.
|
175 |
|
|
|
176 |
|
|
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
|
177 |
|
|
Query or modify the configuration options of the
|
178 |
|
|
widget. If no <EM>option</EM> is specified, returns a list
|
179 |
|
|
describing all of the available options for <EM>pathName</EM>
|
180 |
|
|
(see <STRONG>Tk_ConfigureInfo</STRONG> for information on the format of
|
181 |
|
|
this list). If <EM>option</EM> is specified with no <EM>value</EM>, then
|
182 |
|
|
the command returns a list describing the one named
|
183 |
|
|
option (this list will be identical to the correspond-
|
184 |
|
|
ing sublist of the value returned if no <EM>option</EM> is
|
185 |
|
|
specified). If one or more <EM>option</EM> - <EM>value</EM> pairs are
|
186 |
|
|
specified, then the command modifies the given widget
|
187 |
|
|
option(s) to have the given value(s); in this case the
|
188 |
|
|
command returns an empty string. <EM>Option</EM> may have any
|
189 |
|
|
of the values accepted by the <STRONG>optionmenu</STRONG> command.
|
190 |
|
|
|
191 |
|
|
<EM>pathName</EM> <STRONG>delete</STRONG> <EM>first</EM> ?<EM>last</EM>?
|
192 |
|
|
Delete all of the option menu entries between <EM>first</EM> and
|
193 |
|
|
<EM>last</EM> inclusive. If <EM>last</EM> is omitted then it defaults to
|
194 |
|
|
<EM>first</EM>.
|
195 |
|
|
|
196 |
|
|
<EM>pathName</EM> <STRONG>disable</STRONG> <EM>index</EM>
|
197 |
|
|
Disable the option menu entry specified by <EM>index</EM>. Disa-
|
198 |
|
|
bling a menu item will prevent the user from being able
|
199 |
|
|
to select this item from the menu. This only effects
|
200 |
|
|
the state of the item in the menu, in other words,
|
201 |
|
|
should the item be the currently selected item, the
|
202 |
|
|
programmer is responsible for determining this condi-
|
203 |
|
|
tion and taking appropriate action.
|
204 |
|
|
|
205 |
|
|
<EM>pathName</EM> <STRONG>enable</STRONG> <EM>index</EM>
|
206 |
|
|
Enable the option menu entry specified by <EM>index</EM>. Ena-
|
207 |
|
|
bling a menu item allows the user to select this item
|
208 |
|
|
from the menu.
|
209 |
|
|
|
210 |
|
|
<EM>pathName</EM> <STRONG>get</STRONG>
|
211 |
|
|
Returns the currently selected option menu item.
|
212 |
|
|
|
213 |
|
|
<EM>pathName</EM> <STRONG>index</STRONG> <EM>index</EM>
|
214 |
|
|
Returns the numerical index corresponding to <EM>index</EM>.
|
215 |
|
|
|
216 |
|
|
<EM>pathName</EM> <STRONG>insert</STRONG> <EM>index</EM> <EM>string</EM> ?<EM>string</EM>?
|
217 |
|
|
Insert an item, or list of items, into the menu at
|
218 |
|
|
location <EM>index</EM>.
|
219 |
|
|
|
220 |
|
|
<EM>pathName</EM> <STRONG>select</STRONG> <EM>index</EM>
|
221 |
|
|
Select an item from the option menu to be displayed as
|
222 |
|
|
the currently selected item.
|
223 |
|
|
|
224 |
|
|
<EM>pathName</EM> <STRONG>sort</STRONG> <EM>mode</EM>
|
225 |
|
|
Sort the current menu in either <STRONG>ascending</STRONG>, or <STRONG>descend-</STRONG>
|
226 |
|
|
<STRONG>ing</STRONG> order. The values <STRONG>increasing</STRONG>, or <STRONG>decreasing</STRONG> are
|
227 |
|
|
also accepted.
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
</PRE>
|
232 |
|
|
<H2>COMPONENTS</H2><PRE>
|
233 |
|
|
Name: <STRONG>menuBtn</STRONG>
|
234 |
|
|
Class: <STRONG>Frame</STRONG>
|
235 |
|
|
|
236 |
|
|
The menuBtn component is the option menu button which
|
237 |
|
|
displays the current choice from the popup menu. See
|
238 |
|
|
the "frame" widget manual entry for details on the
|
239 |
|
|
menuBtn component item.
|
240 |
|
|
|
241 |
|
|
Name: <STRONG>menuLabel</STRONG>
|
242 |
|
|
Class: <STRONG>Label</STRONG>
|
243 |
|
|
|
244 |
|
|
The menuLabel component is the label whose text is the
|
245 |
|
|
currently selected choice from the popup menu. See the
|
246 |
|
|
"label" widget manual entry for details on the menuLa-
|
247 |
|
|
bel component item.
|
248 |
|
|
|
249 |
|
|
Name: <STRONG>popupMenu</STRONG>
|
250 |
|
|
Class: <STRONG>Menu</STRONG>
|
251 |
|
|
|
252 |
|
|
The popupMenu component is menu displayed upon selec-
|
253 |
|
|
tion of the menu button. The menu contains the choices
|
254 |
|
|
for the option menu. See the "menu" widget manual
|
255 |
|
|
entry for details on the popupMenu component item.
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
</PRE>
|
260 |
|
|
<H2>EXAMPLE</H2><PRE>
|
261 |
|
|
optionmenu .om -labelmargin 5 \
|
262 |
|
|
-labelon true -labelpos w -labeltext "Operating System :" \
|
263 |
|
|
-items {Unix VMS Linux OS/2 {Windows NT} DOS}
|
264 |
|
|
|
265 |
|
|
.om insert end CPM {MS DOS} HP/UX
|
266 |
|
|
.om sort ascending
|
267 |
|
|
.om select Linux
|
268 |
|
|
|
269 |
|
|
pack .om -padx 10 -pady 10
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
</PRE>
|
274 |
|
|
<H2>ACKNOWLEDGEMENTS:</H2><PRE>
|
275 |
|
|
Michael J. McLennan
|
276 |
|
|
|
277 |
|
|
Borrowed some ideas (next & previous) from OptionButton
|
278 |
|
|
class.
|
279 |
|
|
|
280 |
|
|
Steven B. Jaggers
|
281 |
|
|
|
282 |
|
|
Provided an initial prototype in [incr Tcl].
|
283 |
|
|
|
284 |
|
|
Bret Schuhmacher
|
285 |
|
|
|
286 |
|
|
Helped with popup menu functionality.
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
</PRE>
|
290 |
|
|
<H2>AUTHOR</H2><PRE>
|
291 |
|
|
Alfredo Jahn
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
</PRE>
|
295 |
|
|
<H2>KEYWORDS</H2><PRE>
|
296 |
|
|
optionmenu, widget
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
</PRE>
|
302 |
|
|
</BODY>
|
303 |
|
|
</HTML>
|