1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
|
<HTML>
<HEAD>
<TITLE>iwidgets2.2.0 User Commands - combobox</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>iwidgets2.2.0 User Commands - combobox</H1>
<HR>
<PRE>
</PRE>
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
</PRE>
<H2>NAME</H2><PRE>
combobox - Create and manipulate combination box widgets
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>combobox</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
</PRE>
<H2>INHERITANCE</H2><PRE>
itk::Widget <- LabeledWidget <- Entryfield <- Combobox
</PRE>
<H2>STANDARD OPTIONS</H2><PRE>
<STRONG>background</STRONG> <STRONG>borderWidth</STRONG> <STRONG>cursor</STRONG> <STRONG>exportSelection</STRONG>
<STRONG>foreground</STRONG> <STRONG>highlightColor</STRONG> <STRONG>highlightThicknessinsertBackground</STRONG>
<STRONG>insertBorderWidth</STRONG> <STRONG>insertOffTime</STRONG> <STRONG>insertOnTimeinsertWidth</STRONG>
<STRONG>justify</STRONG> <STRONG>relief</STRONG> <STRONG>selectBackgroundselectBorderWidth</STRONG>
<STRONG>selectForeground</STRONG> <STRONG>textVariable</STRONG> <STRONG>width</STRONG>
See the "options" manual entry for details on the standard
options.
</PRE>
<H2>ASSOCIATED OPTIONS</H2><PRE>
<STRONG>hscrollmode</STRONG> <STRONG>items</STRONG> <STRONG>textBackground</STRONG> <STRONG>textFont</STRONG>
<STRONG>vscrollmode</STRONG>
See the "scrolledlistbox" manual entry for details on the
above inherited options.
<STRONG>show</STRONG> <STRONG>state</STRONG>
See the "entry" manual entry for details on the above inher-
ited options.
</PRE>
<H2>INHERITED OPTIONS</H2><PRE>
<STRONG>childSitePos</STRONG> <STRONG>command</STRONG> <STRONG>fixed</STRONG> <STRONG>focusCommand</STRONG>
<STRONG>invalid</STRONG> <STRONG>textBackground</STRONG> <STRONG>textFont</STRONG> <STRONG>validate</STRONG>
See the "entryfield" class manual entry for details on the
inherited options.
<STRONG>labelBitmap</STRONG> <STRONG>labelFont</STRONG> <STRONG>labelImage</STRONG> <STRONG>labelMargin</STRONG>
<STRONG>labelPos</STRONG> <STRONG>labelText</STRONG> <STRONG>labelVariable</STRONG>
See the "labeledwidget" class manual entry for details on
the inherited options.
</PRE>
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
Name: <STRONG>autoClear</STRONG>
Class: <STRONG>AutoClear</STRONG>
Command-Line Switch: <STRONG>-autoclear</STRONG>
Boolean value that specifies wheather or not to clear
the entry field as items are added to the list given in
any of the forms acceptable to <STRONG>Tcl_GetBoolean</STRONG>. The
default is true.
Name: <STRONG>arrowRelief</STRONG>
Class: <STRONG>Relief</STRONG>
Command-Line Switch: <STRONG>-arrowrelief</STRONG>
Specifies the relief style to use for a dropdown
Combobox's arrow button in a normal (not depressed)
state. Acceptable values are <STRONG>raised</STRONG>, <STRONG>sunken</STRONG>, <STRONG>flat</STRONG>,
<STRONG>ridge</STRONG>, and <STRONG>groove</STRONG>. Sunken is discouraged as this is the
relief used to indicate a depressed state. This option
has no effect on simple Comboboxes. The default is
raised.
Name: <STRONG>dropdown</STRONG>
Class: <STRONG>Dropdown</STRONG>
Command-Line Switch: <STRONG>-dropdown</STRONG>
Boolean describing the Combobox layout style given in
any of the forms acceptable to <STRONG>Tcl_GetBoolean</STRONG>. If true,
the Combobox will be a dropdown style widget which
displays an entry field and an arrow button which when
activated will pop up a scrollable list of items. If
false, a simple Combobox style will be used which has
an entry field and a scrollable list beneath it which
is always visible. Both styles allow an optional label
for the entry field area. The default is true.
Name: <STRONG>editable</STRONG>
Class: <STRONG>Editable</STRONG>
Command-Line Switch: <STRONG>-editable</STRONG>
Boolean describing whether or not the text entry area
is editable by the user. If true the user can add items
to the combobox by entering text into the entry area
and then pressing Return. If false, the list of items
is non-editable and can only be changed by calling the
insert or delete methods. Given in any of the forms
acceptable to <STRONG>Tcl_GetBoolean</STRONG>. The default is true.
Name: <STRONG>flipArrow</STRONG>
Class: <STRONG>FlipArrow</STRONG>
Command-Line Switch: <STRONG>-fliparrow</STRONG>
Boolean describing whether or not the arrow button of
dropdowns should be reversed (point up) when the list
is popped up. Given in any of the forms acceptable to
<STRONG>Tcl_GetBoolean</STRONG>. The default is false.
Name: <STRONG>listHeight</STRONG>
Class: <STRONG>Height</STRONG>
Command-Line Switch: <STRONG>-listheight</STRONG>
Height of the listbox specified in any of the forms
acceptable to <STRONG>Tk_GetPixels</STRONG>. The default is 100 pixels.
Name: <STRONG>margin</STRONG>
Class: <STRONG>Margin</STRONG>
Command-Line Switch: <STRONG>-margin</STRONG>
Specifies the width in pixels between the entry com-
ponent and the arrow button for a dropdown Combobox
given in any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>.
This option has no effect on a simple Combobox. The
default is 0.
Name: <STRONG>popupCursor</STRONG>
Class: <STRONG>Cursor</STRONG>
Command-Line Switch: <STRONG>-popupcursor</STRONG>
Specifies the cursor to be used for dropdown style
listboxes. The value may have any of the forms accept-
able to <STRONG>Tk_GetCursor</STRONG>. The default is arrow.
Name: <STRONG>selectionCommand</STRONG>
Class: <STRONG>SelectionCommand</STRONG>
Command-Line Switch: <STRONG>-selectioncommand</STRONG>
Specifies a Tcl command procedure which is called when
an item in the listbox area is selected. The item will
be selected in the list, the listbox will be removed if
it is a dropdown Combobox, and the selected item's text
will be inserted into the entry field before the
-selectioncommand proc is called. The default is {}.
Name: <STRONG>unique</STRONG>
Class: <STRONG>Unique</STRONG>
Command-Line Switch: <STRONG>-unique</STRONG>
Boolean describing whether or not duplicate items are
allowed in the combobox list. If true, then duplicates
are not allowed to be inserted. If false, a duplicate
entry causes selection of the item. Given in any of the
forms acceptable to <STRONG>Tcl_GetBoolean</STRONG>. The default is
true.
</PRE>
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The <STRONG>combobox</STRONG> command creates an enhanced entry field widget
with an optional associated label and a scrollable list.
When an item is selected in the list area of a Combobox it's
value is then displayed in the entry field text area. Func-
tionally similar to an Optionmenu, the Combobox adds
(optional) list scrolling and (optional) item editing and
inserting capabilities.
There are two basic styles of Comboboxes (determined by the
-dropdown option): dropdown and simple. The dropdown style
adds an arrow button to the right of the entry field which
when activated will pop up (and down) the scrolled listbox
beneath the entry field. The simple (non-dropdown) Combobox
permanently displays the listbox beneath the entry field and
has no arrow button. Either style allows an optional entry
field label.
</PRE>
<H2>METHODS</H2><PRE>
The <STRONG>combobox</STRONG> command creates a new Tcl command whose name is
<EM>pathName</EM>. This command may be used to invoke various opera-
tions on the widget. It has the following general form:
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
<EM>Option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
mand. The following commands are possible for Combobox widg-
ets:
</PRE>
<H2>ASSOCIATED METHODS</H2><PRE>
<STRONG>icursor</STRONG> <STRONG>scan</STRONG>
See the "entry" manual entries for details on the above
associated methods.
<STRONG>curselection</STRONG> <STRONG>index</STRONG> <STRONG>see</STRONG> <STRONG>size</STRONG>
<STRONG>xview</STRONG> <STRONG>yview</STRONG>
See the "listbox" manual entries for details on the above
associated methods.
<STRONG>getcurselection</STRONG> <STRONG>justify</STRONG> <STRONG>sort</STRONG>
See the "scrolledlistbox" manual entries for details on the
above associated methods.
</PRE>
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
Returns the current value of the configuration option
given by <EM>option</EM>. <EM>Option</EM> may have any of the values
accepted by the <STRONG>combobox</STRONG> command.
<EM>pathName</EM> <STRONG>clear</STRONG> ?<STRONG>component</STRONG>?
Clears the contents from one or both components. Valid
component values are <STRONG>list</STRONG>, or <STRONG>entry</STRONG>. With no component
specified, both are cleared.
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
Query or modify the configuration options of the
widget. If no <EM>option</EM> is specified, returns a list
describing all of the available options for <EM>pathName</EM>
(see <STRONG>Tk_ConfigureInfo</STRONG> for information on the format of
this list). If <EM>option</EM> is specified with no <EM>value</EM>, then
the command returns a list describing the one named
option (this list will be identical to the correspond-
ing sublist of the value returned if no <EM>option</EM> is
specified). If one or more <EM>option</EM> - <EM>value</EM> pairs are
specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the
command returns an empty string. <EM>Option</EM> may have any
of the values accepted by the <STRONG>combobox</STRONG> command.
<EM>pathName</EM> <STRONG>delete</STRONG> <EM>component</EM> <EM>first</EM> ?<EM>last</EM>?
Delete one or more elements from a given component,
<STRONG>list</STRONG> or <STRONG>entry</STRONG>. If a list item to be removed is
currently selected (displayed in the entry field area),
the entry field will be cleared.
<EM>pathName</EM> <STRONG>get</STRONG> <STRONG>?</STRONG><EM>index</EM>?
With no arguments, returns the contents currently in
the entry field area. With a single argument, returns
the contents of the listbox item at the indicated
index.
<EM>pathName</EM> <STRONG>insert</STRONG> <EM>component</EM> <EM>index</EM> <EM>element</EM> ?<EM>element</EM> <EM>element</EM> ...?
Insert one or more new elements into the given com-
ponent, <STRONG>list</STRONG> or <STRONG>entry</STRONG>, just before the element given by
<EM>index</EM>.
<EM>pathName</EM> <STRONG>selection</STRONG> <EM>option</EM> <EM>first</EM> ?<EM>last</EM>?
Adjust the selection within the listbox component and
updates the contents of the entry field component to
the value of the selected item. See the "listbox"
manual entry for more details on parameter options.
</PRE>
<H2>COMPONENTS</H2><PRE>
Name: <STRONG>entry</STRONG>
Class: <STRONG>Entryfield</STRONG>
Text entry area where the current selection is
displayed. If the Combobox is editable, the user can
edit the contents of this item.
Name: <STRONG>list</STRONG>
Class: <STRONG>Scrolledlistbox</STRONG>
Scrollable list which stores all the items which the
user can select from. For dropdown Comboboxes, this
component is hidden until the user pops it up by press-
ing on the arrow button to the right of the entry com-
ponent. For simple Comboboxes this component is always
visible just beneath the entry component.
</PRE>
<H2>DEFAULT BINDINGS</H2><PRE>
The Combobox generally has the same bindings as it's primary
component items - the Scrolledlistbox and Entryfield. How-
ever it also adds these:
[1] Button-1 mouse press on the arrow key of a dropdown Com-
bobox causes the list to be popped up. If the combobox is
non-editable, a Button-1 press on the entry field area will
also pop up the list.
[2] Button-1 mouse press anywhere on the display removes a
dropdown listbox which has been popped up, unless the
keypress is upon one of the Combobox scrollbars which
scrolls the list. If it is pressed upon an item in the list
area, that item will be selected before the list is removed.
[3] Button-3 mouse press on the arrow key of a dropdown Com-
bobox causes the next item to be selected. Shift-Button-3
causes the previous item to be selected.
[4] Escape keypress removes a dropdown list which has been
popped up.
[5] The <space> and <Return> keystrokes select the current
item. They also remove the popped up list for dropdown com-
boboxes.
[6] Up and Down arrow keypresses from the entry field and
arrow button component cause the previous and next items in
the listbox to be selected respectively. Ctl-P and Ctl-N are
similarly mapped for emacs emulation.
[7] Entry field and arrow button component Shift-Up and
Shift-Down arrow keys pop up and down the listbox of a drop-
down Combobox. The arrow button component also maps <Return>
and <space> similarly.
</PRE>
<H2>EXAMPLE</H2><PRE>
proc selectCmd {} {
puts stdout "[.cb2 getcurselection]"
}
#
# Non-editable Dropdown Combobox
#
combobox .cb1 -labeltext Month: \
-selectioncommand {puts "selected: [.cb1 getcurselection]"} \
-editable false -listheight 185 -popupcursor hand1 \
-items {Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec}
#
# Editable Dropdown Combobox
#
combobox .cb2 -labeltext "Operating System:" \
-items {Linux HP-UX SunOS Solaris Irix} -selectioncommand selectCmd
#
# Simple Combobox
#
combobox .cb3 -labeltext Fonts: -labelpos nw \
-dropdown false -listheight 220 -items [exec xlsfonts]
pack .cb1 -padx 10 -pady 10 -fill x
pack .cb2 -padx 10 -pady 10 -fill x
pack .cb3 -padx 10 -pady 10 -fill x
</PRE>
<H2>AUTHOR</H2><PRE>
John S. Sigler
</PRE>
<H2>KEYWORDS</H2><PRE>
combobox, entryfield, scrolledlistbox, itk::Widget, entry,
listbox, widget, iwidgets
</PRE>
</BODY>
</HTML>
|