1iwidgets::scrolledlistbox  − Create and manipulate scrolled list‐
2box   widgets   iwidgets::scrolledlistbox   pathName    ?options?
3itk::Widget  <‐ iwidgets::Labeledwidget <‐ iwidgets::Scrolledwid‐
4get <‐ iwidgets::Scrolledlistbox

activeBackground background borderWidth cursor

exportSelection foreground highlightColor highlightThickness

relief selectBackground selectBorderWidth selectForeground

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

selectMode listvariable

11See  the  "listbox"  widget manual entry for details on the above
12associated options.

activeRelief elementBorderwidth jumptroughColor

14See the "scrollbar" widget manual entry for details on the  above
15associated options.

disabledForeground labelBitmap labelFontlabelImage

labelMargin labelPos labelText labelVariable

state sticky

19See the "labeledwidget" class manual entry for details on the in‐
20herited options.
21Name:           dblClickCommand
22Class:          Command
23Command‐Line Switch:           ‐dblclickcommand
24Specifies a Tcl command procedure which is called when an item is
25double  clicked.   Typically  this  occurs when mouse button 1 is
26double clicked over an item.  Selection policy does not matter.
27Name:           height
28Class:          Height
29Command‐Line Switch:           ‐height
30Specifies the height of the scrolled list box as an entire  unit.
31The  value  may  be  specified  in any of the forms acceptable to

Tk_GetPixels. Any additional space needed to display the other

33components  such  as  labels,  margins,  and scrollbars force the
34listbox to be compressed.  A value of zero along  with  the  same
35value  for  the width causes the value given for the visibleitems
36option to be applied which administers geometry constraints in  a
37different manner.  The default height is zero.
38Name:           hscrollMode
39Class:          ScrollMode
40Command‐Line Switch:           ‐hscrollmode
41Specifies  the  the  display  mode  to be used for the horizontal
42scrollbar: static, dynamic, or none.  In static mode, the  scroll
43bar  is displayed at all times.  Dynamic mode displays the scroll
44bar as required, and none disables the scroll bar  display.   The
45default is static.
46Name:           sbWidth
47Class:          Width
48Command‐Line Switch:           ‐sbwidth
49Specifies  the width of the scrollbar in any of the forms accept‐
50able to Tk_GetPixels.  The default width is 15 pixels..
51Name:           scrollMargin
52Class:          Margin
53Command‐Line Switch:           ‐scrollmargin
54Specifies the distance between the listbox and scrollbar  in  any
55of  the  forms acceptable to Tk_GetPixels.  The default is 3 pix‐
56els.
57Name:           selectionCommand
58Class:          Command
59Command‐Line Switch:           ‐selectioncommand
60Specifies a Tcl command procedure which is called when an item is
61selected.  Selection policy does not matter.
62Name:           state
63Class:          State
64Command‐Line Switch:           ‐state
65Specifies  one of two states for the listbox: normal or disabled.
66If the listbox is disabled then selection is  ignored.   The  de‐
67fault is normal.
68Name:           textBackground
69Class:          Background
70Command‐Line Switch ‐textbackground
71Specifies  the background color for the listbox.  This allows the
72background within the listbox to be  different  from  the  normal
73background color.
74Name:           textFont
75Class:          Font
76Command‐Line Switch:           ‐textfont
77Specifies  the font to be used for text in the listbox.  This al‐
78lows for the font associated with text internal to  the  scrolled
79listbox to be different than the font for labels.
80Name:           visibleitems
81Class:          VisibleItems
82Command‐Line Switch:           ‐visibleitems
83Specifies  the widthxheight in characters and lines for the list‐
84box.  This option is only administered if the  width  and  height
85options  are  both  set  to zero, otherwise they take precedence.
86The default value is 20x10.  With  the  visibleitems  option  en‐
87gaged,  geometry  constraints are maintained only on the listbox.
88The size of the other components such  as  labels,  margins,  and
89scroll  bars, are additive and independent, effecting the overall
90size of the scrolled list box.  In contrast, should the width and
91height  options  have  non  zero  values, they are applied to the
92scrolled list box as a whole.  The listbox is compressed  or  ex‐
93panded to maintain the geometry constraints.
94Name:           vscrollMode
95Class:          ScrollMode
96Command‐Line Switch:           ‐vscrollmode
97Specifies  the  the  display  mode  to  be  used for the vertical
98scrollbar: static, dynamic, or none.  In static mode, the  scroll
99bar  is displayed at all times.  Dynamic mode displays the scroll
100bar as required, and none disables the scroll bar  display.   The
101default is static.
102Name:           width
103Class:          Width
104Command‐Line Switch:           ‐width
105Specifies  the  width of the scrolled list box as an entire unit.
106The value may be specified in any  of  the  forms  acceptable  to

Tk_GetPixels. Any additional space needed to display the other

108components such as labels,  margins,  and  scrollbars  force  the
109listbox  to  be  compressed.  A value of zero along with the same
110value for the height causes the value given for the  visibleitems
111option  to be applied which administers geometry constraints in a
112different manner.  The default width is zero.
113
114The iwidgets::scrolledlistbox command creates a scrolled  listbox
115with additional options to manage horizontal and vertical scroll‐
116bars.  This includes options to control which scrollbars are dis‐
117played and the method, i.e. statically or dynamically.
118
119The  iwidgets::scrolledlistbox  command creates a new Tcl command
120whose name is pathName.  This command may be used to invoke vari‐
121ous operations on the widget.  It has the following general form:

pathName option ?arg arg ...? Option and the args determine the

123exact behavior of the command.  Many of the widget commands for a
124scrolledlistbox take as one argument an indicator of which  entry
125of  the  list box to operate on.  These indicators are called in‐

dexes and may be specified in any of the following forms: number

127Specifies  the  element as a numerical index, where 0 corresponds
128to the first element in the listbox.  active Indicates  the  ele‐
129ment  that  has  the  location cursor.  This element will be dis‐
130played with an underline when the listbox has the keyboard focus,
131and it is specified with the activate widget command.  anchor In‐
132dicates the anchor point for the selection, which is set with the

selection anchor widget command. end Indicates the end of the

134listbox.  For some commands this means just after the  last  ele‐
135ment;  for  other commands it means the last element.  @x,y Indi‐
136cates the element that covers the point  in  the  listbox  window
137specified  by x and y (in pixel coordinates).  If no element cov‐
138ers that point, then the closest element to that point  is  used.

pattern If the index doesn’t satisfy one of the above forms then

140this form is used.  Pattern is pattern‐matched against the  items
141in the list box, in order from the top down, until a matching en‐
142try is found.  The rules of Tcl_StringMatch are used.   The  fol‐
143lowing widget commands are possible for scrolledlistbox widgets:
144

activate bbox curselection delete

get index insert itemconfigure

nearest scan see selection

size xview yview

149See  the  "listbox"  manual  entry  for details on the associated
150methods.
151

pathName cget option Returns the current value of the configura‐

153tion  option  given by option.  Option may have any of the values
154accepted  by  the  iwidgets::scrolledlistbox  command.   pathName

clear Clears the listbox of all items. pathName configure ?op‐

tion? ?value option value ...? Query or modify the configuration

157options of the widget.  If no option is specified, returns a list
158describing all of the available options for pathName (see Tk_Con‐

figureInfo for information on the format of this list). If op‐

tion is specified with no value, then the command returns a list

161describing  the  one named option (this list will be identical to
162the corresponding sublist of the value returned if no  option  is
163specified).   If  one  or  more option−value pairs are specified,
164then the command modifies the given widget option(s) to have  the
165given  value(s);   in  this  case  the  command  returns an empty
166string.  Option may have any of the values accepted by the  iwid‐

gets::scrolledlistbox command. pathName getcurselection Returns

168the contents of the listbox element indicated by the current  se‐
169lection  indexes.  Short cut version of get and curselection com‐
170mand combination.  pathName justify direction Justifies the  list
171contents  via  teh  scroll  bars in one of four directions: left,

right, top, or bottom. pathName selecteditemcount Returns the

173number  of  items  currently selected in the list.  pathName sort

order Sort the current list in any of the forms accepted by Tcl’s

175lsort  command.   Also accepts either ascending or descending or‐
176der.
177
178Name:           listbox
179Class:          listbox
180The listbox component is the listbox widget.  See  the  "listbox"
181widget manual entry for details on the listbox component item.
182Name:           horizsb
183Class:          Scrollbar
184The  horizsb  component  is  the  horizontal scroll bar.  See the
185"scrollbar" widget manual entry for details on the horizsb compo‐
186nent item.
187Name:           vertsb
188Class:          Scrollbar
189The  vertsb  component  is  the  vertical  scroll  bar.   See the
190"scrollbar" widget manual entry for details on the vertsb  compo‐
191nent item.
192
193 package require Iwidgets 4.0
194 option add *textBackground white
195 proc selCmd {} {
196    puts stdout "[.slb getcurselection]"
197 }
198 proc defCmd {} {
199    puts stdout "Double Click"
200    return [selCmd]
201 }
202 iwidgets::scrolledlistbox .slb ‐selection single \
203    ‐vscrollmode static ‐hscrollmode dynamic ‐labeltext "List" \
204    ‐selectioncommand selCmd ‐dblclickcommand defCmd
205 pack .slb ‐padx 10 ‐pady 10 ‐fill both ‐expand yes
206 .slb  insert  end  {Hello  {Out  There}  World}  Mark L. Ulferts
207scrolledlistbox, listbox, widget
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
Impressum