File: combobox.n.html

package info (click to toggle)
itcl3.0 3.0.1-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,128 kB
  • ctags: 3,519
  • sloc: tcl: 32,416; ansic: 12,683; sh: 3,917; makefile: 692; awk: 273; perl: 265
file content (562 lines) | stat: -rw-r--r-- 16,702 bytes parent folder | download | duplicates (8)
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
<!-- manual page source format generated by RosettaMan v2.5a6, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>man page(1) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="#toc">Table of Contents</A><P>
_________________________________________________________________
<P>

<H2><A NAME="sect1" HREF="#toc1"><B>NAME</B></A></H2>

combobox - Create and manipulate combination box widgets
<P>

<H2><A NAME="sect2" HREF="#toc2"><B>SYNOPSIS</B></A></H2>

<B>combobox</B> <I>pathName</I> ?<I>options</I>?
<P>

<H2><A NAME="sect3" HREF="#toc3"><B>INHERITANCE</B></A></H2>

itk::Widget &lt;- LabeledWidget &lt;- Entryfield &lt;- Combobox
<P>

<H2><A NAME="sect4" HREF="#toc4"><B>STANDARD</B> <B>OPTIONS</B></A></H2>

<B>background</B>      <B>borderWidth</B>    <B>cursor</B>          <B>justify</B>
<DL>
<DT><B>exportSelection</B> <B>foreground</B> <DD>    <B>highlightColor</B> <B>highlightThickness</B>
</DD>
</DL>
<DL>
<DT><B>relief</B> <DD>         <B>width</B>          <B>insertWidth</B>     <B>insertBackground</B>
<B>insertOffTime</B> <B>insertOnTime</B> <B>insertWidth</B>     <B>insertBorderWidth</B>
</DD>
</DL>
<DL>
<DT><B>selectForeground</B> <DD>              <B>selectBackground</B>
</DD>
</DL>
<DL>
<DT><B>selectBorderWidth</B> <DD>             <B>textVariable</B>
<P>
</DD>
</DL>
See the &quot;options&quot; manual entry for details on the standard
options.
<P>

<H2><A NAME="sect5" HREF="#toc5"><B>ASSOCIATED</B> <B>OPTIONS</B></A></H2>

<B>hscrollmode</B>     <B>textBackground</B> <B>textFont</B>        <B>vscrollmode</B>
<P>
See the &quot;scrolledlistbox&quot; manual entry for details on the
above inherited options.
<P>
<B>show</B>
<P>
See the &quot;entry&quot; manual entry for details on the above inherited
option.
<P>

<H2><A NAME="sect6" HREF="#toc6"><B>INHERITED</B> <B>OPTIONS</B></A></H2>

<B>childSitePos</B>    <B>command</B>        <B>fixed</B>           <B>focusCommand</B>
<DL>
<DT><B>invalid</B> <DD>        <B>textBackground</B> <B>textFont</B>        <B>validate</B>
<P>
</DD>
</DL>
See the &quot;entryfield&quot; class manual entry for details on the
inherited options.
<P>
<B>labelBitmap</B>     <B>labelFont</B>      <B>labelImage</B>      <B>labelMargin</B>
<DL>
<DT><B>labelPos</B> <DD>       <B>labelText</B>      <B>labelVariable</B>
<P>
</DD>
</DL>
See the &quot;labeledwidget&quot; class manual entry for details on
the inherited options.
<P>

<H2><A NAME="sect7" HREF="#toc7"><B>WIDGET-SPECIFIC</B> <B>OPTIONS</B></A></H2>

<DL>
<DT>Name: <DD>          <B>arrowRelief</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Relief</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-arrowrelief</B>
<P>
</DD>
</DL>
Specifies the relief style to use for a dropdown
Combobox's arrow button in a normal (not depressed)
state. Acceptable values are <B>raised</B>, <B>sunken</B>, <B>flat</B>,
<B>ridge</B>, and <B>groove</B>. 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.
<P>
<DL>
<DT>Name: <DD>          <B>completion</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Completion</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-completion</B>
<P>
</DD>
</DL>
Boolean given in any of the forms acceptable to
<B>Tcl_GetBoolean</B> which determines whether insertions into
the entry field, whether from the keyboard or programmatically
via the <B>insert</B> method, are automatically completed
with the first matching item from the listbox.
The default is true.
<P>
<DL>
<DT>Name: <DD>          <B>dropdown</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Dropdown</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-dropdown</B>
<P>
</DD>
</DL>
Boolean describing the Combobox layout style given in
any of the forms acceptable to <B>Tcl_GetBoolean</B>. 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.
<P>
<DL>
<DT>Name: <DD>          <B>editable</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Editable</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-editable</B>
<P>
</DD>
</DL>
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. (The value in the entry field
can still be modified by selecting from the list.)
Given in any of the forms acceptable to <B>Tcl_GetBoolean</B>.
The default is true.
<P>
<DL>
<DT>Name: <DD>          <B>grab</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Grab</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-grab</B>
<P>
</DD>
</DL>
This option sets the grab scope for the appearance of
the listbox in drop-down comboboxes. It can be either
global or local. The default is local.
<P>
<DL>
<DT>Name: <DD>          <B>listHeight</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Height</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-listheight</B>
<P>
</DD>
</DL>
Height of the listbox specified in any of the forms
acceptable to <B>Tk_GetPixels</B>. The default is 150 pixels.
<P>
<DL>
<DT>Name: <DD>          <B>margin</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Margin</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-margin</B>
<P>
</DD>
</DL>
Specifies the width in pixels between the entry component
and the arrow button for a dropdown Combobox
given in any of the forms acceptable to <B>Tk_GetPixels</B>.
This option has no effect on a simple Combobox. The
default is 1.
<P>
<DL>
<DT>Name: <DD>          <B>popupCursor</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Cursor</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-popupcursor</B>
<P>
</DD>
</DL>
Specifies the cursor to be used for dropdown style
listboxes. The value may have any of the forms acceptable
to <B>Tk_GetCursor</B>. The default is arrow.
<P>
<DL>
<DT>Name: <DD>          <B>selectionCommand</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>SelectionCommand</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-selectioncommand</B>
<P>
</DD>
</DL>
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 {}.
<P>
<DL>
<DT>Name: <DD>          <B>state</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>State</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-state</B>
<P>
</DD>
</DL>
Specifies the overall state of the Combobox megawidget.
Can be either normal or disabled. If the Combobox is
disabled, no text can be entered into the entry field,
no selection can be made in the listbox, and the
arrowBtn component is disabled. The default is normal.
<P>
<DL>
<DT>Name: <DD>          <B>unique</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Unique</B>
</DD>
</DL>
<DL>
<DT>Command-Line Switch: <DD>          <B>-unique</B>
<P>
</DD>
</DL>
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 <B>Tcl_GetBoolean</B>. The default is
true.<BR>

_________________________________________________________________
<P>

<H2><A NAME="sect8" HREF="#toc8"><B>DESCRIPTION</B></A></H2>

The <B>combobox</B> 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, its
value is then displayed in the entry field text area. Functionally
similar to an Optionmenu, the Combobox adds
(optional) list scrolling and (optional) item editing and
inserting capabilities.
<P>
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.
<P>

<H2><A NAME="sect9" HREF="#toc9"><B>METHODS</B></A></H2>

The <B>combobox</B> command creates a new Tcl command whose name is
<I>pathName</I>. This command may be used to invoke various operations
on the widget. It has the following general form:
<P>
<I>pathName</I> <I>option</I> ?<I>arg</I> <I>arg</I> ...?
<P>
<I>Option</I> and the <I>arg</I>s determine the exact behavior of the command.
The following commands are possible for Combobox widgets:
<P>

<H2><A NAME="sect10" HREF="#toc10"><B>ASSOCIATED</B> <B>METHODS</B></A></H2>

<DL>
<DT><B>icursor</B> <DD>        <B>scan</B>
<P>
</DD>
</DL>
See the &quot;entry&quot; manual entries for details on the above
associated methods.
<P>
<B>curselection</B>    <B>index</B>          <B>see</B>             <B>size</B>
<DL>
<DT><B>xview</B> <DD>          <B>yview</B>
<P>
</DD>
</DL>
See the &quot;listbox&quot; manual entries for details on the above
associated methods.
<P>
<DL>
<DT><B>getcurselection</B> <B>justify</B> <DD>       <B>sort</B>
<P>
</DD>
</DL>
See the &quot;scrolledlistbox&quot; manual entries for details on the
above associated methods.
<P>

<H2><A NAME="sect11" HREF="#toc11"><B>WIDGET-SPECIFIC</B> <B>METHODS</B></A></H2>

<I>pathName</I> <B>cget</B> <I>option</I><BR>

Returns the current value of the configuration option
given by <I>option</I>. <I>Option</I> may have any of the values
accepted by the <B>combobox</B> command.
<P>
<I>pathName</I> <B>clear</B> ?<B>component</B>?<BR>

Clears the contents from one or both components. Valid
component values are <B>list</B>, or <B>entry</B>. With no component
specified, both are cleared.
<P>
<I>pathName</I> <B>configure</B> ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
Query or modify the configuration options of the
widget. If no <I>option</I> is specified, returns a list
describing all of the available options for <I>pathName</I>
(see <B>Tk_ConfigureInfo</B> for information on the format of
this list). If <I>option</I> is specified with no <I>value</I>, then
the command returns a list describing the one named
option (this list will be identical to the corresponding
sublist of the value returned if no <I>option</I> is
specified). If one or more <I>option</I> - <I>value</I> 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. <I>Option</I> may have any
of the values accepted by the <B>combobox</B> command.
<P>
<I>pathName</I> <B>delete</B> <I>component</I> <I>first</I> ?<I>last</I>?<BR>

Delete one or more elements from a given component,
<B>list</B> or <B>entry</B>. If a list item to be removed is
currently selected (displayed in the entry field area),
the entry field will be cleared.
<P>
<I>pathName</I> <B>get</B> <B>?index</B>?<BR>

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.
<P>
<I>pathName</I> <B>insert</B> <I>component</I> <I>index</I> <I>element</I> ?<I>element</I> <I>element</I> ...?
Insert one or more new elements into the given component,
<B>list</B> or <B>entry</B>, just before the element given by
<I>index</I>.
<P>
<I>pathName</I> <B>selection</B> <I>option</I> <I>first</I> ?<I>last</I>?<BR>

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 &quot;listbox"
manual entry for more details on parameter options.
<P>

<H2><A NAME="sect12" HREF="#toc12"><B>COMPONENTS</B></A></H2>

<DL>
<DT>Name: <DD>          <B>entry</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Entry</B>
<P>
</DD>
</DL>
Text entry area where the current selection is
displayed. If the Combobox is editable and its state is
normal, the user can edit the contents of this item.
<P>
<DL>
<DT>Name: <DD>          <B>list</B>
</DD>
</DL>
<DL>
<DT>Class: <DD>         <B>Scrolledlistbox</B>
<P>
</DD>
</DL>
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 pressing
on the arrow button to the right of the entry component.
For simple Comboboxes this component is always
visible just beneath the entry component.
<P>

<H2><A NAME="sect13" HREF="#toc13"><B>DEFAULT</B> <B>BINDINGS</B></A></H2>

The Combobox generally has the same bindings as its primary
component items - the Scrolledlistbox and Entryfield. However
it also adds these:
<P>
[1] Button-1 mouse press on the arrow key of a dropdown Combobox
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.
<P>
[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.
<P>
[3] Button-3 mouse press on the arrow key of a dropdown Combobox
causes the next item to be selected. Shift-Button-3
causes the previous item to be selected.
<P>
[4] Escape keypress removes a dropdown list which has been
popped up.
<P>
[5] The &lt;space&gt; and &lt;Return&gt; keystrokes select the current
item. They also remove the popped up list for dropdown comboboxes.
<P>
[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.
<P>
[7] Entry field and arrow button component Shift-Up and
Shift-Down arrow keys pop up and down the listbox of a
dropdown Combobox. The arrow button component also maps
&lt;Return&gt; and &lt;space&gt; similarly.
<P>

<H2><A NAME="sect14" HREF="#toc14"><B>EXAMPLE</B></A></H2>

proc selectCmd {} {<BR>

puts stdout &quot;[.cb2 getcurselection]"
}
<P>
#<BR>

# Non-editable Dropdown Combobox<BR>

#<BR>

combobox .cb1 -labeltext Month: \<BR>

-selectioncommand {puts &quot;selected: [.cb1 getcurselection]"} \
-editable false -listheight 185 -popupcursor hand1
.cb1 insert list end Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec
<P>
#<BR>

# Editable Dropdown Combobox<BR>

#<BR>

combobox .cb2 -labeltext &quot;Operating System:&quot; -selectioncommand selectCmd
.cb2 insert list end Linux HP-UX SunOS Solaris Irix
.cb2 insert entry end L
<P>
pack .cb1 -padx 10 -pady 10 -fill x
pack .cb2 -padx 10 -pady 10 -fill x
<P>

<H2><A NAME="sect15" HREF="#toc15"><B>ORIGINAL</B> <B>AUTHOR</B></A></H2>

John S. Sigler
<P>

<H2><A NAME="sect16" HREF="#toc16"><B>CURRENT</B> <B>MAINTAINER</B></A></H2>

Mitch Gorman (logain@erols.com)
<P>

<H2><A NAME="sect17" HREF="#toc17"><B>KEYWORDS</B></A></H2>

combobox, entryfield, scrolledlistbox, itk::Widget, entry,
listbox, widget, iwidgets
<P>

<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc1" HREF="#sect1">NAME</A></LI>
<LI><A NAME="toc2" HREF="#sect2">SYNOPSIS</A></LI>
<LI><A NAME="toc3" HREF="#sect3">INHERITANCE</A></LI>
<LI><A NAME="toc4" HREF="#sect4">STANDARD OPTIONS</A></LI>
<LI><A NAME="toc5" HREF="#sect5">ASSOCIATED OPTIONS</A></LI>
<LI><A NAME="toc6" HREF="#sect6">INHERITED OPTIONS</A></LI>
<LI><A NAME="toc7" HREF="#sect7">WIDGET-SPECIFIC OPTIONS</A></LI>
<LI><A NAME="toc8" HREF="#sect8">DESCRIPTION</A></LI>
<LI><A NAME="toc9" HREF="#sect9">METHODS</A></LI>
<LI><A NAME="toc10" HREF="#sect10">ASSOCIATED METHODS</A></LI>
<LI><A NAME="toc11" HREF="#sect11">WIDGET-SPECIFIC METHODS</A></LI>
<LI><A NAME="toc12" HREF="#sect12">COMPONENTS</A></LI>
<LI><A NAME="toc13" HREF="#sect13">DEFAULT BINDINGS</A></LI>
<LI><A NAME="toc14" HREF="#sect14">EXAMPLE</A></LI>
<LI><A NAME="toc15" HREF="#sect15">ORIGINAL AUTHOR</A></LI>
<LI><A NAME="toc16" HREF="#sect16">CURRENT MAINTAINER</A></LI>
<LI><A NAME="toc17" HREF="#sect17">KEYWORDS</A></LI>
</UL>
</BODY></HTML>