1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1995 John S. Sigler
|
3 |
|
|
'\" Copyright (c) 1997 Mitch Gorman
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" @(#) Combobox.n
|
9 |
|
|
'/"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.HS combobox iwid
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
combobox \- Create and manipulate combination box widgets
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBcombobox\fI \fIpathName \fR?\fIoptions\fR?
|
18 |
|
|
.SH "INHERITANCE"
|
19 |
|
|
itk::Widget <- LabeledWidget <- Entryfield <- Combobox
|
20 |
|
|
.SH "STANDARD OPTIONS"
|
21 |
|
|
.LP
|
22 |
|
|
.ta 4c 8c 12c
|
23 |
|
|
.nf
|
24 |
|
|
|
25 |
|
|
\fB\fR
|
26 |
|
|
\fB
|
27 |
|
|
background borderWidth cursor justify
|
28 |
|
|
exportSelection foreground highlightColor highlightThickness
|
29 |
|
|
relief width insertWidth insertBackground
|
30 |
|
|
insertOffTime insertOnTime insertWidth insertBorderWidth
|
31 |
|
|
selectForeground selectBackground
|
32 |
|
|
selectBorderWidth textVariable
|
33 |
|
|
\fR
|
34 |
|
|
.fi
|
35 |
|
|
.LP
|
36 |
|
|
See the "options" manual entry for details on the standard options.
|
37 |
|
|
.SH "ASSOCIATED OPTIONS"
|
38 |
|
|
.LP
|
39 |
|
|
.nf
|
40 |
|
|
.ta 4c 8c 12c
|
41 |
|
|
\fBhscrollmode\fR \fBtextBackground\fR \fBtextFont\fR \fBvscrollmode\fR
|
42 |
|
|
.fi
|
43 |
|
|
.LP
|
44 |
|
|
See the "scrolledlistbox" manual entry for details on the above inherited
|
45 |
|
|
options.
|
46 |
|
|
.LP
|
47 |
|
|
.nf
|
48 |
|
|
.ta 4c 8c 12c
|
49 |
|
|
\fBshow\fR
|
50 |
|
|
.fi
|
51 |
|
|
.LP
|
52 |
|
|
See the "entry" manual entry for details on the above inherited option.
|
53 |
|
|
.SH "INHERITED OPTIONS"
|
54 |
|
|
.LP
|
55 |
|
|
.nf
|
56 |
|
|
.ta 4c 8c 12c
|
57 |
|
|
\fBchildSitePos\fR \fBcommand\fR \fBfixed\fR \fBfocusCommand\fR
|
58 |
|
|
\fBinvalid\fR \fBtextBackground\fR \fBtextFont\fR \fBvalidate\fR
|
59 |
|
|
.fi
|
60 |
|
|
.LP
|
61 |
|
|
See the "entryfield" class manual entry for details on the inherited options.
|
62 |
|
|
.LP
|
63 |
|
|
.nf
|
64 |
|
|
.ta 4c 8c 12c
|
65 |
|
|
\fBlabelBitmap\fR \fBlabelFont\fR \fBlabelImage\fR \fBlabelMargin\fR
|
66 |
|
|
\fBlabelPos\fR \fBlabelText\fR \fBlabelVariable\fR
|
67 |
|
|
.fi
|
68 |
|
|
.LP
|
69 |
|
|
See the "labeledwidget" class manual entry for details on the
|
70 |
|
|
inherited options.
|
71 |
|
|
.SH "WIDGET-SPECIFIC OPTIONS"
|
72 |
|
|
.LP
|
73 |
|
|
.nf
|
74 |
|
|
Name: \fBarrowRelief\fR
|
75 |
|
|
Class: \fBRelief\fR
|
76 |
|
|
Command-Line Switch: \fB-arrowrelief\fR
|
77 |
|
|
.fi
|
78 |
|
|
.IP
|
79 |
|
|
Specifies the relief style to use for a dropdown Combobox's arrow
|
80 |
|
|
button in a normal (not depressed) state. Acceptable values
|
81 |
|
|
are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR, and \fBgroove\fR.
|
82 |
|
|
Sunken is discouraged as this is the relief used to indicate a depressed
|
83 |
|
|
state. This option has no effect on simple Comboboxes. The default is raised.
|
84 |
|
|
.LP
|
85 |
|
|
.nf
|
86 |
|
|
Name: \fBcompletion\fR
|
87 |
|
|
Class: \fBCompletion\fR
|
88 |
|
|
Command-Line Switch: \fB-completion\fR
|
89 |
|
|
.fi
|
90 |
|
|
.IP
|
91 |
|
|
Boolean given in any of the forms acceptable to \fBTcl_GetBoolean\fR which
|
92 |
|
|
determines whether insertions into the entry field, whether from the
|
93 |
|
|
keyboard or programmatically via the \fBinsert\fR method, are
|
94 |
|
|
automatically completed with the first matching item from the listbox. The
|
95 |
|
|
default is true.
|
96 |
|
|
.LP
|
97 |
|
|
.nf
|
98 |
|
|
Name: \fBdropdown\fR
|
99 |
|
|
Class: \fBDropdown\fR
|
100 |
|
|
Command-Line Switch: \fB-dropdown\fR
|
101 |
|
|
.fi
|
102 |
|
|
.IP
|
103 |
|
|
Boolean describing the Combobox layout style given in any of the forms
|
104 |
|
|
acceptable to \fBTcl_GetBoolean\fR. If true, the Combobox
|
105 |
|
|
will be a dropdown style
|
106 |
|
|
widget which displays an entry field and an arrow button which when activated
|
107 |
|
|
will pop up a scrollable list of items. If false, a simple Combobox style
|
108 |
|
|
will be used which has an entry field and a scrollable list beneath it
|
109 |
|
|
which is always visible. Both styles allow an optional label for the entry
|
110 |
|
|
field area. The default is true.
|
111 |
|
|
.LP
|
112 |
|
|
.nf
|
113 |
|
|
Name: \fBeditable\fR
|
114 |
|
|
Class: \fBEditable\fR
|
115 |
|
|
Command-Line Switch: \fB-editable\fR
|
116 |
|
|
.fi
|
117 |
|
|
.IP
|
118 |
|
|
Boolean describing whether or not the text entry area is editable
|
119 |
|
|
by the user. If true the user can add items to the combobox by entering text
|
120 |
|
|
into the entry area and then pressing Return. If false, the list of items is
|
121 |
|
|
non-editable and can only be changed by calling the insert or delete
|
122 |
|
|
methods. (The value in the entry field can still be modified by selecting
|
123 |
|
|
from the list.) Given in any of the forms acceptable to \fBTcl_GetBoolean\fR.
|
124 |
|
|
The default is true.
|
125 |
|
|
.LP
|
126 |
|
|
.nf
|
127 |
|
|
Name: \fBgrab\fR
|
128 |
|
|
Class: \fBGrab\fR
|
129 |
|
|
Command-Line Switch: \fB-grab\fR
|
130 |
|
|
.fi
|
131 |
|
|
.IP
|
132 |
|
|
This option sets the grab scope for the appearance of the listbox in
|
133 |
|
|
drop-down comboboxes. It can be either global or local. The default is
|
134 |
|
|
local.
|
135 |
|
|
.LP
|
136 |
|
|
.nf
|
137 |
|
|
Name: \fBlistHeight\fR
|
138 |
|
|
Class: \fBHeight\fR
|
139 |
|
|
Command-Line Switch: \fB-listheight\fR
|
140 |
|
|
.fi
|
141 |
|
|
.IP
|
142 |
|
|
Height of the listbox specified in any of the forms acceptable to
|
143 |
|
|
\fBTk_GetPixels\fR. The default is 150 pixels.
|
144 |
|
|
.LP
|
145 |
|
|
.nf
|
146 |
|
|
Name: \fBmargin\fR
|
147 |
|
|
Class: \fBMargin\fR
|
148 |
|
|
Command-Line Switch: \fB-margin\fR
|
149 |
|
|
.fi
|
150 |
|
|
.IP
|
151 |
|
|
Specifies the width in pixels between the entry component and the arrow button
|
152 |
|
|
for a dropdown Combobox given in any of the forms acceptable to
|
153 |
|
|
\fBTk_GetPixels\fR. This option has no effect on a simple Combobox. The
|
154 |
|
|
default is 1.
|
155 |
|
|
.LP
|
156 |
|
|
.nf
|
157 |
|
|
Name: \fBpopupCursor\fR
|
158 |
|
|
Class: \fBCursor\fR
|
159 |
|
|
Command-Line Switch: \fB-popupcursor\fR
|
160 |
|
|
.fi
|
161 |
|
|
.IP
|
162 |
|
|
Specifies the cursor to be used for dropdown style listboxes. The value
|
163 |
|
|
may have any of the forms acceptable to \fBTk_GetCursor\fR. The default is
|
164 |
|
|
arrow.
|
165 |
|
|
.LP
|
166 |
|
|
.nf
|
167 |
|
|
Name: \fBselectionCommand\fR
|
168 |
|
|
Class: \fBSelectionCommand\fR
|
169 |
|
|
Command-Line Switch: \fB-selectioncommand\fR
|
170 |
|
|
.fi
|
171 |
|
|
.IP
|
172 |
|
|
Specifies a Tcl command procedure which is called when an item in the
|
173 |
|
|
listbox area is selected. The item will be selected in the list, the listbox
|
174 |
|
|
will be removed if it is a dropdown Combobox, and the selected item's
|
175 |
|
|
text will be inserted into the entry field before the -selectioncommand proc is
|
176 |
|
|
called. The default is {}.
|
177 |
|
|
.LP
|
178 |
|
|
.nf
|
179 |
|
|
Name: \fBstate\fR
|
180 |
|
|
Class: \fBState\fR
|
181 |
|
|
Command-Line Switch: \fB-state\fR
|
182 |
|
|
.fi
|
183 |
|
|
.IP
|
184 |
|
|
Specifies the overall state of the Combobox megawidget. Can be either
|
185 |
|
|
normal or disabled. If the Combobox is disabled, no text can be entered
|
186 |
|
|
into the entry field, no selection can be made in the listbox, and the
|
187 |
|
|
arrowBtn component is disabled. The default is normal.
|
188 |
|
|
.LP
|
189 |
|
|
.nf
|
190 |
|
|
Name: \fBunique\fR
|
191 |
|
|
Class: \fBUnique\fR
|
192 |
|
|
Command-Line Switch: \fB-unique\fR
|
193 |
|
|
.fi
|
194 |
|
|
.IP
|
195 |
|
|
Boolean describing whether or not duplicate items are allowed in the combobox
|
196 |
|
|
list. If true, then duplicates are not allowed to be inserted. If false, a
|
197 |
|
|
duplicate entry causes selection of the item. Given in any of the forms
|
198 |
|
|
acceptable to \fBTcl_GetBoolean\fR. The default is true.
|
199 |
|
|
.BE
|
200 |
|
|
|
201 |
|
|
.SH DESCRIPTION
|
202 |
|
|
.PP
|
203 |
|
|
The \fBcombobox\fR command creates an enhanced entry field widget with an
|
204 |
|
|
optional associated label and a scrollable list. When an item is selected in
|
205 |
|
|
the list area of a Combobox, its value is then displayed in the entry field
|
206 |
|
|
text area. Functionally similar to an Optionmenu, the Combobox adds (optional)
|
207 |
|
|
list scrolling and (optional) item editing and inserting capabilities.
|
208 |
|
|
.PP
|
209 |
|
|
There are two basic styles of Comboboxes (determined by the -dropdown option):
|
210 |
|
|
dropdown and simple. The dropdown style adds an arrow button to the right of
|
211 |
|
|
the entry field which when activated will pop up (and down) the scrolled
|
212 |
|
|
listbox beneath the entry field. The simple (non-dropdown) Combobox
|
213 |
|
|
permanently displays the listbox beneath the entry field and has no
|
214 |
|
|
arrow button. Either style allows an optional entry field label.
|
215 |
|
|
.SH "METHODS"
|
216 |
|
|
.PP
|
217 |
|
|
The \fBcombobox\fR command creates a new Tcl command whose
|
218 |
|
|
name is \fIpathName\fR. This
|
219 |
|
|
command may be used to invoke various
|
220 |
|
|
operations on the widget. It has the following general form:
|
221 |
|
|
.DS C
|
222 |
|
|
\fIpathName option \fR?\fIarg arg ...\fR?
|
223 |
|
|
.DE
|
224 |
|
|
\fIOption\fR and the \fIarg\fRs
|
225 |
|
|
determine the exact behavior of the command. The following
|
226 |
|
|
commands are possible for Combobox widgets:
|
227 |
|
|
.SH "ASSOCIATED METHODS"
|
228 |
|
|
.LP
|
229 |
|
|
.nf
|
230 |
|
|
.ta 4c 8c 12c
|
231 |
|
|
\fBicursor\fR \fBscan\fR
|
232 |
|
|
.fi
|
233 |
|
|
.LP
|
234 |
|
|
See the "entry" manual entries for details on the above associated methods.
|
235 |
|
|
.LP
|
236 |
|
|
.nf
|
237 |
|
|
.ta 4c 8c 12c
|
238 |
|
|
\fBcurselection\fR \fBindex\fR \fBsee\fR \fBsize\fR
|
239 |
|
|
\fBxview\fR \fByview\fR
|
240 |
|
|
.fi
|
241 |
|
|
.LP
|
242 |
|
|
See the "listbox" manual entries for details on the above associated methods.
|
243 |
|
|
.LP
|
244 |
|
|
.nf
|
245 |
|
|
.ta 4c 8c 12c
|
246 |
|
|
\fBgetcurselection\fR \fBjustify\fR \fBsort\fR
|
247 |
|
|
.fi
|
248 |
|
|
.LP
|
249 |
|
|
See the "scrolledlistbox" manual entries for details on the above associated
|
250 |
|
|
methods.
|
251 |
|
|
.LP
|
252 |
|
|
.SH "WIDGET-SPECIFIC METHODS"
|
253 |
|
|
.TP
|
254 |
|
|
\fIpathName \fBcget\fR \fIoption\fR
|
255 |
|
|
Returns the current value of the configuration option given
|
256 |
|
|
by \fIoption\fR.
|
257 |
|
|
\fIOption\fR may have any of the values accepted by the \fBcombobox\fR
|
258 |
|
|
command.
|
259 |
|
|
.TP
|
260 |
|
|
\fIpathName \fBclear\fR ?\fBcomponent\fR?
|
261 |
|
|
Clears the contents from one or both components. Valid component values
|
262 |
|
|
are \fBlist\fR, or \fBentry\fR. With no component specified, both are cleared.
|
263 |
|
|
.TP
|
264 |
|
|
\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
|
265 |
|
|
Query or modify the configuration options of the widget.
|
266 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
267 |
|
|
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
|
268 |
|
|
information on the format of this list). If \fIoption\fR is specified
|
269 |
|
|
with no \fIvalue\fR, then the command returns a list describing the
|
270 |
|
|
one named option (this list will be identical to the corresponding
|
271 |
|
|
sublist of the value returned if no \fIoption\fR is specified). If
|
272 |
|
|
one or more \fIoption\-value\fR pairs are specified, then the command
|
273 |
|
|
modifies the given widget option(s) to have the given value(s); in
|
274 |
|
|
this case the command returns an empty string.
|
275 |
|
|
\fIOption\fR may have any of the values accepted by the \fBcombobox\fR
|
276 |
|
|
command.
|
277 |
|
|
.TP
|
278 |
|
|
\fIpathName \fBdelete \fIcomponent\fR \fIfirst\fR ?\fIlast\fR?
|
279 |
|
|
Delete one or more elements from a given component, \fBlist\fR or \fBentry\fR.
|
280 |
|
|
If a list item to be removed is currently selected (displayed in the entry
|
281 |
|
|
field area), the entry field will be cleared.
|
282 |
|
|
.TP
|
283 |
|
|
\fIpathName \fBget ?\fIindex\fR? \fR
|
284 |
|
|
With no arguments, returns the contents currently in the entry
|
285 |
|
|
field area. With a single argument, returns the contents of the
|
286 |
|
|
listbox item at the indicated index.
|
287 |
|
|
.TP
|
288 |
|
|
\fIpathName \fBinsert\fR \fIcomponent\fR \fIindex\fR \fIelement\fR ?\fIelement element ...\fR?
|
289 |
|
|
Insert one or more new elements into the given component, \fBlist\fR or
|
290 |
|
|
\fBentry\fR, just before the element given by \fIindex\fR.
|
291 |
|
|
.TP
|
292 |
|
|
\fIpathName \fBselection\fR \fIoption\fR \fIfirst\fR ?\fIlast\fR?
|
293 |
|
|
Adjust the selection within the listbox component and updates the contents
|
294 |
|
|
of the entry field component to the value of the selected item. See the
|
295 |
|
|
"listbox" manual entry for more details on parameter options.
|
296 |
|
|
.SH "COMPONENTS"
|
297 |
|
|
.LP
|
298 |
|
|
.nf
|
299 |
|
|
Name: \fBentry\fR
|
300 |
|
|
Class: \fBEntry\fR
|
301 |
|
|
.fi
|
302 |
|
|
.IP
|
303 |
|
|
Text entry area where the current selection is displayed. If the
|
304 |
|
|
Combobox is editable and its state is normal, the user can edit the
|
305 |
|
|
contents of this item.
|
306 |
|
|
.LP
|
307 |
|
|
.nf
|
308 |
|
|
Name: \fBlist\fR
|
309 |
|
|
Class: \fBScrolledlistbox\fR
|
310 |
|
|
.fi
|
311 |
|
|
.IP
|
312 |
|
|
Scrollable list which stores all the items which the user can select
|
313 |
|
|
from. For dropdown Comboboxes, this component is hidden until the user pops it
|
314 |
|
|
up by pressing on the arrow button to the right of the entry component. For
|
315 |
|
|
simple Comboboxes this component is always visible just beneath the entry
|
316 |
|
|
component.
|
317 |
|
|
.SH "DEFAULT BINDINGS"
|
318 |
|
|
.PP
|
319 |
|
|
The Combobox generally has the same bindings as its primary component items -
|
320 |
|
|
the Scrolledlistbox and Entryfield. However it also adds these:
|
321 |
|
|
.PP
|
322 |
|
|
[1] Button-1 mouse press on the arrow key of a dropdown Combobox causes the
|
323 |
|
|
list to be popped up. If the combobox is non-editable, a Button-1 press on the
|
324 |
|
|
entry field area will also pop up the list.
|
325 |
|
|
.PP
|
326 |
|
|
[2] Button-1 mouse press anywhere on the display removes a dropdown listbox
|
327 |
|
|
which has been popped up, unless the keypress is upon one of the Combobox
|
328 |
|
|
scrollbars which scrolls the list. If it is pressed upon an item in the list
|
329 |
|
|
area, that item will be selected before the list is removed.
|
330 |
|
|
.PP
|
331 |
|
|
[3] Button-3 mouse press on the arrow key of a dropdown Combobox causes the
|
332 |
|
|
next item to be selected. Shift-Button-3 causes the previous item to be
|
333 |
|
|
selected.
|
334 |
|
|
.PP
|
335 |
|
|
[4] Escape keypress removes a dropdown list which has been popped up.
|
336 |
|
|
.PP
|
337 |
|
|
[5] The and keystrokes select the current item. They also
|
338 |
|
|
remove the popped up list for dropdown comboboxes.
|
339 |
|
|
.PP
|
340 |
|
|
[6] Up and Down arrow keypresses from the entry field and arrow button
|
341 |
|
|
component cause the previous and next items in the listbox to be selected
|
342 |
|
|
respectively. Ctl-P and Ctl-N are similarly mapped for emacs emulation.
|
343 |
|
|
.PP
|
344 |
|
|
[7] Entry field and arrow button component Shift-Up and Shift-Down arrow keys
|
345 |
|
|
pop up and down the listbox of a dropdown Combobox. The arrow button component
|
346 |
|
|
also maps and similarly.
|
347 |
|
|
|
348 |
|
|
.SH EXAMPLE
|
349 |
|
|
.DS
|
350 |
|
|
proc selectCmd {} {
|
351 |
|
|
puts stdout "[.cb2 getcurselection]"
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
#
|
355 |
|
|
# Non-editable Dropdown Combobox
|
356 |
|
|
#
|
357 |
|
|
combobox .cb1 -labeltext Month: \\
|
358 |
|
|
-selectioncommand {puts "selected: [.cb1 getcurselection]"} \\
|
359 |
|
|
-editable false -listheight 185 -popupcursor hand1
|
360 |
|
|
.cb1 insert list end Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec
|
361 |
|
|
|
362 |
|
|
#
|
363 |
|
|
# Editable Dropdown Combobox
|
364 |
|
|
#
|
365 |
|
|
combobox .cb2 -labeltext "Operating System:" -selectioncommand selectCmd
|
366 |
|
|
.cb2 insert list end Linux HP-UX SunOS Solaris Irix
|
367 |
|
|
.cb2 insert entry end L
|
368 |
|
|
|
369 |
|
|
pack .cb1 -padx 10 -pady 10 -fill x
|
370 |
|
|
pack .cb2 -padx 10 -pady 10 -fill x
|
371 |
|
|
|
372 |
|
|
.DE
|
373 |
|
|
.SH ORIGINAL AUTHOR
|
374 |
|
|
John S. Sigler
|
375 |
|
|
.SH CURRENT MAINTAINER
|
376 |
|
|
Mitch Gorman (logain@erols.com)
|
377 |
|
|
.SH KEYWORDS
|
378 |
|
|
combobox, entryfield, scrolledlistbox, itk::Widget, entry, listbox, widget,
|
379 |
|
|
iwidgets
|