1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1995 DSC Technologies Corporation
|
3 |
|
|
'\"
|
4 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
5 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
6 |
|
|
'\"
|
7 |
|
|
'\" @(#) optionmenu.n 1.21 94/12/17 16:04:44
|
8 |
|
|
'/"
|
9 |
|
|
.so man.macros
|
10 |
|
|
.HS optionmenu iwid
|
11 |
|
|
.BS
|
12 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
13 |
|
|
.SH NAME
|
14 |
|
|
optionmenu \- Create and manipulate a option menu widget
|
15 |
|
|
.SH SYNOPSIS
|
16 |
|
|
\fBoptionmenu\fI \fIpathName \fR?\fIoptions\fR?
|
17 |
|
|
.SH "INHERITANCE"
|
18 |
|
|
itk::Widget <- Labeledwidget <- optionmenu
|
19 |
|
|
.SH "STANDARD OPTIONS"
|
20 |
|
|
.LP
|
21 |
|
|
.nf
|
22 |
|
|
.ta 4c 8c 12c
|
23 |
|
|
\fBactiveBackground\fR \fBactiveBorderWidth\fR \fBactiveForeground\fR \fBbackground\fR
|
24 |
|
|
\fBborderWidth\fR \fBcursor\fR \fBdisabledForeground\fR \fBfont\fR
|
25 |
|
|
\fBforeground\fR \fBhighlightColor\fR \fBhighlightThickness\fR \fBrelief\fR
|
26 |
|
|
.fi
|
27 |
|
|
.LP
|
28 |
|
|
See the "options" manual entry for details on the standard options.
|
29 |
|
|
.SH "INHERITED OPTIONS"
|
30 |
|
|
.LP
|
31 |
|
|
.nf
|
32 |
|
|
.ta 4c 8c 12c
|
33 |
|
|
\fBdisabledForeground\fR \fBlabelBitmap\fR \fBlabelFont\fR \fBlabelImage\fR
|
34 |
|
|
\fBlabelMargin\fR \fBlabelPos\fR \fBlabelText\fR \fBlabelVariable\fR
|
35 |
|
|
\fBstate\fR
|
36 |
|
|
.fi
|
37 |
|
|
.LP
|
38 |
|
|
See the "LabeledWidget" manual entry for details on the inherited options.
|
39 |
|
|
.SH "WIDGET-SPECIFIC OPTIONS"
|
40 |
|
|
.LP
|
41 |
|
|
.nf
|
42 |
|
|
Name: \fBclickTime\fR
|
43 |
|
|
Class: \fBClickTime\fR
|
44 |
|
|
Command-Line Switch: \fB-clicktime\fR
|
45 |
|
|
.fi
|
46 |
|
|
.IP
|
47 |
|
|
Interval time, in msec, used to determine that a single mouse
|
48 |
|
|
click has occurred. Used to post menu on a "quick" mouse click.
|
49 |
|
|
\fBNote\fR: changing this value may cause the sigle-click
|
50 |
|
|
functionality to not work properly. The default is 150 msec.
|
51 |
|
|
.LP
|
52 |
|
|
.nf
|
53 |
|
|
Name: \fBcommand\fR
|
54 |
|
|
Class: \fBCommand\fR
|
55 |
|
|
Command-Line Switch: \fB-command\fR
|
56 |
|
|
.fi
|
57 |
|
|
.IP
|
58 |
|
|
Specifies a Tcl command procedure to be evaluated following a change in
|
59 |
|
|
the current option menu selection.
|
60 |
|
|
.LP
|
61 |
|
|
.nf
|
62 |
|
|
Name: \fBcyclicOn\fR
|
63 |
|
|
Class: \fBCyclicOn\fR
|
64 |
|
|
Command-Line Switch: \fB-cyclicon\fR
|
65 |
|
|
.fi
|
66 |
|
|
.IP
|
67 |
|
|
Turns on/off the 3rd mouse button capability. The value may be specified
|
68 |
|
|
in any of the forms acceptable to \fBTcl_GetBoolean\fR. This feature
|
69 |
|
|
allows the right mouse button to cycle through the popup
|
70 |
|
|
menu list without poping it up. The right mouse button cycles through
|
71 |
|
|
the menu in reverse order. The default is true.
|
72 |
|
|
.LP
|
73 |
|
|
.nf
|
74 |
|
|
Name: \fBpopupCursor\fR
|
75 |
|
|
Class: \fBCursor\fR
|
76 |
|
|
Command-Line Switch: \fB-popupcursor\fR
|
77 |
|
|
.fi
|
78 |
|
|
.IP
|
79 |
|
|
Specifies the mouse cursor to be used for the popup menu. The value may
|
80 |
|
|
have any of the forms acceptable to \fBTk_GetCursor\fR.
|
81 |
|
|
.LP
|
82 |
|
|
.nf
|
83 |
|
|
Name: \fBstate\fR
|
84 |
|
|
Class: \fBState\fR
|
85 |
|
|
Command-Line Switch: \fB-state\fR
|
86 |
|
|
.fi
|
87 |
|
|
.IP
|
88 |
|
|
Specified one of two states for the optionmenu: \fBnormal\fR, or
|
89 |
|
|
\fBdisabled\fR. If the optionmenu is disabled, then option menu
|
90 |
|
|
selection is ignored.
|
91 |
|
|
.LP
|
92 |
|
|
.nf
|
93 |
|
|
Name: \fBwidth\fR
|
94 |
|
|
Class: \fBWidth\fR
|
95 |
|
|
Command-Line Switch: \fB-width\fR
|
96 |
|
|
.fi
|
97 |
|
|
.IP
|
98 |
|
|
Specifies a fixed size for the menu button label in any of the forms
|
99 |
|
|
acceptable to \Tk_GetPixels\fR. If the text
|
100 |
|
|
is too small to fit in the label, the text is clipped.
|
101 |
|
|
Note: Normally, when a new list is created, or new items are
|
102 |
|
|
added to an existing list, the menu button label is resized
|
103 |
|
|
automatically. Setting this option overrides that functionality.
|
104 |
|
|
.LP
|
105 |
|
|
.BE
|
106 |
|
|
|
107 |
|
|
.SH DESCRIPTION
|
108 |
|
|
.PP
|
109 |
|
|
The \fBoptionmenu\fR command creates an option menu widget with options
|
110 |
|
|
to manage it. An option menu displays a frame containing a label and a button.
|
111 |
|
|
A pop-up menu will allow for the value of the button to change.
|
112 |
|
|
|
113 |
|
|
.SH "METHODS"
|
114 |
|
|
.PP
|
115 |
|
|
The \fBoptionmenu\fR command creates a new Tcl command whose
|
116 |
|
|
name is \fIpathName\fR. This
|
117 |
|
|
command may be used to invoke various
|
118 |
|
|
operations on the widget. It has the following general form:
|
119 |
|
|
.DS
|
120 |
|
|
\fIpathName option \fR?\fIarg arg ...\fR?
|
121 |
|
|
.DE
|
122 |
|
|
\fIOption\fR and the \fIarg\fRs
|
123 |
|
|
determine the exact behavior of the command.
|
124 |
|
|
.PP
|
125 |
|
|
Many of the widget commands for an optionmenu take as one argument an
|
126 |
|
|
indicator of which entry of the option menu to operate on. These
|
127 |
|
|
indicators are called \fIindex\fRes and may be specified in
|
128 |
|
|
any of the following forms:
|
129 |
|
|
.TP 12
|
130 |
|
|
\fInumber\fR
|
131 |
|
|
Specifies the entry numerically, where 0 corresponds
|
132 |
|
|
to the top-most entry of the option menu, 1 to the entry below it, and
|
133 |
|
|
so on.
|
134 |
|
|
.TP 12
|
135 |
|
|
\fBend\fR
|
136 |
|
|
Indicates the bottommost entry in the menu. If there are no
|
137 |
|
|
entries in the menu then zero is returned.
|
138 |
|
|
.TP 12
|
139 |
|
|
\fBselect\fR
|
140 |
|
|
Returns the numerical index of the currently selected option menu entry.
|
141 |
|
|
If no entries exist in the menu, then -1 is returned.
|
142 |
|
|
.TP 12
|
143 |
|
|
\fIpattern\fR
|
144 |
|
|
If the index doesn't satisfy one of the above forms then this
|
145 |
|
|
form is used. \fIPattern\fR is pattern-matched against the label of
|
146 |
|
|
each entry in the option menu, in order from the top down, until a
|
147 |
|
|
matching entry is found. The rules of \fBTcl_StringMatch\fR
|
148 |
|
|
are used.
|
149 |
|
|
.PP
|
150 |
|
|
The following widget commands are possible for optionmenu widgets:
|
151 |
|
|
|
152 |
|
|
.SH "WIDGET-SPECIFIC METHODS"
|
153 |
|
|
.TP
|
154 |
|
|
\fIpathName \fBcget\fR \fIoption\fR
|
155 |
|
|
Returns the current value of the configuration option given
|
156 |
|
|
by \fIoption\fR.
|
157 |
|
|
\fIOption\fR may have any of the values accepted by the \fBoptionmenu\fR
|
158 |
|
|
command.
|
159 |
|
|
.TP
|
160 |
|
|
\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
|
161 |
|
|
Query or modify the configuration options of the widget.
|
162 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
163 |
|
|
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
|
164 |
|
|
information on the format of this list). If \fIoption\fR is specified
|
165 |
|
|
with no \fIvalue\fR, then the command returns a list describing the
|
166 |
|
|
one named option (this list will be identical to the corresponding
|
167 |
|
|
sublist of the value returned if no \fIoption\fR is specified). If
|
168 |
|
|
one or more \fIoption\-value\fR pairs are specified, then the command
|
169 |
|
|
modifies the given widget option(s) to have the given value(s); in
|
170 |
|
|
this case the command returns an empty string.
|
171 |
|
|
\fIOption\fR may have any of the values accepted by the \fBoptionmenu\fR
|
172 |
|
|
command.
|
173 |
|
|
.TP
|
174 |
|
|
\fIpathName \fBdelete \fIfirst\fR ?\fIlast\fR?
|
175 |
|
|
Delete all of the option menu entries between \fIfirst\fR and
|
176 |
|
|
\fIlast\fR inclusive. If \fIlast\fR is omitted then it defaults
|
177 |
|
|
to \fIfirst\fR.
|
178 |
|
|
.TP
|
179 |
|
|
\fIpathName \fBdisable \fIindex\fR
|
180 |
|
|
Disable the option menu entry specified by \fIindex\fR.
|
181 |
|
|
Disabling a menu item will prevent the user from being able to select
|
182 |
|
|
this item from the menu. This only effects the state of the item
|
183 |
|
|
in the menu, in other words, should the item be the currently
|
184 |
|
|
selected item, the programmer is responsible for determining this condition
|
185 |
|
|
and taking appropriate action.
|
186 |
|
|
.TP
|
187 |
|
|
\fIpathName \fBenable \fIindex\fR
|
188 |
|
|
Enable the option menu entry specified by \fIindex\fR.
|
189 |
|
|
Enabling a menu item allows the user to select this item from the menu.
|
190 |
|
|
.TP
|
191 |
|
|
\fIpathName \fBget\fR ?\fIfirst\fR? ?\fIlast\fR?
|
192 |
|
|
If no arguments are specified, this operation returns the currently
|
193 |
|
|
selected option menu item. Otherwise, it returns the name of the
|
194 |
|
|
option at index \fIfirst\fR, or a range of options between \fIfirst\fR
|
195 |
|
|
and \fIlast\fR.
|
196 |
|
|
.TP
|
197 |
|
|
\fIpathName \fBindex \fIindex\fR
|
198 |
|
|
Returns the numerical index corresponding to \fIindex\fR.
|
199 |
|
|
.TP
|
200 |
|
|
\fIpathName \fBinsert \fIindex string\fR ?\fIstring\fR?
|
201 |
|
|
Insert an item, or list of items, into the menu at location \fIindex\fR.
|
202 |
|
|
.TP
|
203 |
|
|
\fIpathName \fBselect \fIindex\fR
|
204 |
|
|
Select an item from the option menu to be displayed as the currently
|
205 |
|
|
selected item.
|
206 |
|
|
.TP
|
207 |
|
|
\fIpathName \fBsort \fImode\fR
|
208 |
|
|
Sort the current menu in either \fBascending\fR, or \fBdescending\fR order.
|
209 |
|
|
The values \fBincreasing\fR, or \fBdecreasing\fR are also accepted.
|
210 |
|
|
|
211 |
|
|
.SH "COMPONENTS"
|
212 |
|
|
.LP
|
213 |
|
|
.nf
|
214 |
|
|
Name: \fBmenuBtn\fR
|
215 |
|
|
Class: \fBMenubutton\fR
|
216 |
|
|
.fi
|
217 |
|
|
.IP
|
218 |
|
|
The menuBtn component is the option menu button which displays the current
|
219 |
|
|
choice from the popup menu. See the "menubutton" widget manual entry
|
220 |
|
|
for details on the menuBtn component item.
|
221 |
|
|
.LP
|
222 |
|
|
.nf
|
223 |
|
|
Name: \fBpopupMenu\fR
|
224 |
|
|
Class: \fBMenu\fR
|
225 |
|
|
.fi
|
226 |
|
|
.IP
|
227 |
|
|
The popupMenu component is menu displayed upon selection of the menu button.
|
228 |
|
|
The menu contains the choices for the option menu. See the "menu" widget
|
229 |
|
|
manual entry for details on the popupMenu component item.
|
230 |
|
|
.fi
|
231 |
|
|
|
232 |
|
|
.SH EXAMPLE
|
233 |
|
|
.DS
|
234 |
|
|
optionmenu .om -labelmargin 5 \\
|
235 |
|
|
-labelon true -labelpos w -labeltext "Operating System :"
|
236 |
|
|
|
237 |
|
|
.om insert end Unix VMS Linux OS/2 {Windows NT} DOS
|
238 |
|
|
.om sort ascending
|
239 |
|
|
.om select Linux
|
240 |
|
|
|
241 |
|
|
pack .om -padx 10 -pady 10
|
242 |
|
|
.DE
|
243 |
|
|
.SH ACKNOWLEDGEMENTS:
|
244 |
|
|
Michael J. McLennan
|
245 |
|
|
.IP
|
246 |
|
|
Borrowed some ideas (next & previous) from OptionButton class.
|
247 |
|
|
.LP
|
248 |
|
|
Steven B. Jaggers
|
249 |
|
|
.IP
|
250 |
|
|
Provided an initial prototype in [incr Tcl].
|
251 |
|
|
.LP
|
252 |
|
|
Bret Schuhmacher
|
253 |
|
|
.IP
|
254 |
|
|
Helped with popup menu functionality.
|
255 |
|
|
.LP
|
256 |
|
|
.SH AUTHOR
|
257 |
|
|
Alfredo Jahn
|
258 |
|
|
.SH KEYWORDS
|
259 |
|
|
optionmenu, widget
|