1iwidgets::combobox  −  Create and manipulate combination box wid‐
2gets iwidgets::combobox pathName ?options?  itk::Widget <‐  iwid‐
3gets::LabeledWidget <‐ iwidgets::Entryfield <‐ iwidgets::Combobox

background borderWidth cursor justify

exportSelection foreground highlightColor highlightThickness

insertWidth insertBackground insertOffTime insertOnTime

insertWidth insertBorderWidth relief selectForeground

selectBackground selectBorderWidth textVariable width

9See  the  "options"  manual entry for details on the standard op‐
10tions.

hscrollmode textBackground textFont vscrollmode

12See the "scrolledlistbox" manual entry for details on  the  above
13inherited options.

show

15See  the  "entry" manual entry for details on the above inherited
16option.

childSitePos command fixed focusCommand

invalid textBackground textFont validate

19See the "entryfield" class manual entry for details on the inher‐
20ited options.

labelBitmap labelFont labelImage labelMargin

labelPos labelText labelVariable sticky

23See the "labeledwidget" class manual entry for details on the in‐
24herited options.
25Name:           arrowRelief
26Class:          Relief
27Command‐Line Switch:           ‐arrowrelief
28Specifies the relief style to use for a dropdown Combobox’s arrow
29button  in  a normal (not depressed) state. Acceptable values are

raised, sunken, flat, ridge, and groove. Sunken is discouraged

31as  this  is  the relief used to indicate a depressed state. This
32option has no effect on simple Comboboxes. The default is raised.
33Name:           completion
34Class:          Completion
35Command‐Line Switch:           ‐completion
36Boolean given in any of the forms  acceptable  to  Tcl_GetBoolean
37which determines whether insertions into the entry field, whether
38from the keyboard or programmatically via the insert method,  are
39automatically  completed  with  the  first matching item from the
40listbox.  The default is true.
41Name:           dropdown
42Class:          Dropdown
43Command‐Line Switch:           ‐dropdown
44Boolean describing the Combobox layout style given in any of  the
45forms acceptable to Tcl_GetBoolean. If true, the Combobox will be
46a dropdown style widget which displays an entry field and an  ar‐
47row  button which when activated will pop up a scrollable list of
48items. If false, a simple Combobox style will be used  which  has
49an  entry  field and a scrollable list beneath it which is always
50visible. Both styles allow an optional label for the entry  field
51area. The default is true.
52Name:           editable
53Class:          Editable
54Command‐Line Switch:           ‐editable
55Boolean describing whether or not the text entry area is editable
56by the user. If true the user can add items to  the  combobox  by
57entering  text  into  the entry area and then pressing Return. If
58false, the list of items is non‐editable and can only be  changed
59by  calling the insert or delete methods. (The value in the entry
60field can still be modified by selecting from the  list.)   Given
61in any of the forms acceptable to Tcl_GetBoolean.  The default is
62true.
63Name:           grab
64Class:          Grab
65Command‐Line Switch:           ‐grab
66This option sets the grab scope for the appearance of the listbox
67in  drop‐down comboboxes.  It can be either global or local.  The
68default is local.
69Name:           listHeight
70Class:          Height
71Command‐Line Switch:           ‐listheight
72Height of the listbox specified in any of the forms acceptable to

Tk_GetPixels. The default is 150 pixels.

74Name:           margin
75Class:          Margin
76Command‐Line Switch:           ‐margin
77Specifies the width in pixels between the entry component and the
78arrow button for a dropdown Combobox given in any  of  the  forms
79acceptable to Tk_GetPixels. This option has no effect on a simple
80Combobox. The default is 1.
81Name:           popupCursor
82Class:          Cursor
83Command‐Line Switch:           ‐popupcursor
84Specifies the cursor to be used for dropdown style listboxes. The
85value  may  have any of the forms acceptable to Tk_GetCursor. The
86default is arrow.
87Name:           selectionCommand
88Class:          SelectionCommand
89Command‐Line Switch:           ‐selectioncommand
90Specifies a Tcl command procedure which is called when an item in
91the  listbox  area  is selected. The item will be selected in the
92list, the listbox will be removed if it is a  dropdown  Combobox,
93and  the  selected  item’s  text  will be inserted into the entry
94field before the ‐selectioncommand proc is called. The default is
95{}.
96Name:           state
97Class:          State
98Command‐Line Switch:           ‐state
99Specifies  the  overall state of the Combobox megawidget.  Can be
100either normal or disabled.  If the Combobox is disabled, no  text
101can  be entered into the entry field, no selection can be made in
102the listbox, and the arrowBtn component is disabled.  The default
103is normal.
104Name:           unique
105Class:          Unique
106Command‐Line Switch:           ‐unique
107Boolean  describing whether or not duplicate items are allowed in
108the combobox list. If true, then duplicates are not allowed to be
109inserted.  If  false,  a  duplicate entry causes selection of the
110item. Given in any of the forms acceptable to Tcl_GetBoolean. The
111default is true.
112
113The  iwidgets::combobox  command  creates an enhanced entry field
114widget with an optional associated label and a  scrollable  list.
115When an item is selected in the list area of a Combobox, its val‐
116ue is then displayed in the entry field text  area.  Functionally
117similar  to  an  Optionmenu,  the  Combobox  adds (optional) list
118scrolling and (optional) item editing and inserting capabilities.
119There  are  two  basic  styles  of  Comboboxes (determined by the
120‐dropdown option): dropdown and simple. The dropdown  style  adds
121an  arrow button to the right of the entry field which when acti‐
122vated will pop up (and down) the scrolled listbox beneath the en‐
123try  field.  The  simple (non‐dropdown) Combobox permanently dis‐
124plays the listbox beneath the entry field and has no  arrow  but‐
125ton.  Either  style  allows  an  optional entry field label.  The

iwidgets::combobox command creates a new Tcl command whose name

127is  pathName.  This  command may be used to invoke various opera‐
128tions on the widget. It has the following general form:  pathName

option ?arg arg ...? Option and the args determine the exact be‐

130havior of the command. The following commands  are  possible  for
131Combobox widgets:

icursor scan

133See the "entry" manual entries for details on the above associat‐
134ed methods.

curselection index see size

xview yview

137See the "listbox" manual entries for details on the above associ‐
138ated methods.

getcurselection justify sort

140See the "scrolledlistbox" manual entries for details on the above
141associated methods.  pathName cget  option  Returns  the  current
142value  of  the  configuration option given by option.  Option may
143have any of the values accepted by  the  iwidgets::combobox  com‐
144mand.   pathName  clear ?component?  Clears the contents from one
145or both components. Valid component values are  list,  or  entry.
146With  no component specified, both are cleared.  pathName config‐

ure ?option? ?value option value ...? Query or modify the con‐

148figuration options of the widget.  If no option is specified, re‐
149turns a list describing all of the available options for pathName
150(see  Tk_ConfigureInfo  for  information  on  the  format of this
151list).  If option is specified with no value,  then  the  command
152returns a list describing the one named option (this list will be
153identical to the corresponding sublist of the value  returned  if
154no  option  is specified).  If one or more option−value pairs are
155specified, then the command modifies the given  widget  option(s)
156to  have the given value(s);  in this case the command returns an
157empty string.  Option may have any of the values accepted by  the

iwidgets::combobox command. pathName delete component first

159?last?  Delete one or more elements from a given component,  list
160or  entry.   If  a  list item to be removed is currently selected
161(displayed in the entry field area),  the  entry  field  will  be
162cleared.   pathName  get  ?index?  With no arguments, returns the
163contents currently in the entry field area. With a  single  argu‐
164ment,  returns  the contents of the listbox item at the indicated
165index.  pathName insert component index element ?element  element

...? Insert one or more new elements into the given component,

list or entry, just before the element given by index. pathName

selection option first ?last? Adjust the selection within the

169listbox component and updates the contents  of  the  entry  field
170component  to  the  value of the selected item. See the "listbox"
171manual entry for more details on parameter options.
172Name:           entry
173Class:          Entry
174Text entry area where the current selection is displayed. If  the
175Combobox  is  editable and its state is normal, the user can edit
176the contents of this item.
177Name:           list
178Class:          Scrolledlistbox
179Scrollable list which stores all the items which the user can se‐
180lect  from. For dropdown Comboboxes, this component is hidden un‐
181til the user pops it up by pressing on the arrow  button  to  the
182right  of  the entry component. For simple Comboboxes this compo‐
183nent is always visible just beneath  the  entry  component.   The
184Combobox generally has the same bindings as its primary component
185items ‐ the Scrolledlistbox and Entryfield. However it also  adds
186these:  [1]  Button‐1  mouse press on the arrow key of a dropdown
187Combobox causes the list to be popped up. If the combobox is non‐
188editable,  a Button‐1 press on the entry field area will also pop
189up the list.  [2] Button‐1 mouse press anywhere  on  the  display
190removes  a  dropdown listbox which has been popped up, unless the
191keypress is upon one of the Combobox scrollbars which scrolls the
192list.  If  it is pressed upon an item in the list area, that item
193will be selected before the list is removed.  [3] Button‐3  mouse
194press  on  the  arrow  key of a dropdown Combobox causes the next
195item to be selected. Shift‐Button‐3 causes the previous  item  to
196be  selected.   [4] Escape keypress removes a dropdown list which
197has been popped up.  [5] The <space> and <Return> keystrokes  se‐
198lect  the  current  item. They also remove the popped up list for
199dropdown comboboxes.  [6] Up and Down arrow keypresses  from  the
200entry  field  and  arrow  button component cause the previous and
201next items in the listbox to be selected respectively. Ctl‐P  and
202Ctl‐N  are similarly mapped for emacs emulation.  [7] Entry field
203and arrow button component Shift‐Up and Shift‐Down arrow keys pop
204up  and down the listbox of a dropdown Combobox. The arrow button
205component also maps <Return> and <space> similarly.
206
207 package require Iwidgets 4.0
208 proc selectCmd {} {
209    puts stdout "[.cb2 getcurselection]"
210 }
211
212 #
213 # Non‐editable Dropdown Combobox
214 #
215 iwidgets::combobox .cb1 ‐labeltext Month: \
216     ‐selectioncommand {puts "selected: [.cb1  getcurselection]"}
217\
218     ‐editable false ‐listheight 185 ‐popupcursor hand1
219 .cb1  insert  list end Jan Feb Mar Apr May June Jul Aug Sept Oct
220Nov Dec
221 #
222 # Editable Dropdown Combobox
223 #
224 iwidgets::combobox .cb2 ‐labeltext "Operating  System:"  ‐selec‐
225tioncommand selectCmd
226 .cb2 insert list end Linux HP‐UX SunOS Solaris Irix
227 .cb2 insert entry end L
228
229 pack .cb1 ‐padx 10 ‐pady 10 ‐fill x
230 pack .cb2 ‐padx 10 ‐pady 10 ‐fill x
231
232John  S.  Sigler Mitch Gorman (logain@erols.com) combobox, entry‐
233field,  scrolledlistbox,  itk::Widget,  entry,  listbox,  widget,
234iwidgets
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
Impressum