1 |
578 |
markom |
<HTML>
|
2 |
|
|
<HEAD>
|
3 |
|
|
<TITLE>iwidgets2.2.0 User Commands - scrolledlistbox</TITLE>
|
4 |
|
|
</HEAD>
|
5 |
|
|
<BODY BGCOLOR="#FFFFFF">
|
6 |
|
|
<H1>iwidgets2.2.0 User Commands - scrolledlistbox</H1>
|
7 |
|
|
<HR>
|
8 |
|
|
<PRE>
|
9 |
|
|
|
10 |
|
|
</PRE>
|
11 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
</PRE>
|
15 |
|
|
<H2>NAME</H2><PRE>
|
16 |
|
|
scrolledlistbox - Create and manipulate scrolled listbox
|
17 |
|
|
widgets
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
</PRE>
|
21 |
|
|
<H2>SYNOPSIS</H2><PRE>
|
22 |
|
|
<STRONG>scrolledlistbox</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
</PRE>
|
26 |
|
|
<H2>INHERITANCE</H2><PRE>
|
27 |
|
|
itk::Widget <- Labeledwidget <- Scrolledlistbox
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
</PRE>
|
31 |
|
|
<H2>STANDARD OPTIONS</H2><PRE>
|
32 |
|
|
<STRONG>activeBackground</STRONG> <STRONG>background</STRONG> <STRONG>borderWidthcursor</STRONG>
|
33 |
|
|
<STRONG>exportSelection</STRONG> <STRONG>foreground</STRONG> <STRONG>highlightColor</STRONG> <STRONG>highlightThickness</STRONG>
|
34 |
|
|
<STRONG>relief</STRONG> <STRONG>repeatDelay</STRONG> <STRONG>repeatInterval</STRONG> <STRONG>selectBackground</STRONG>
|
35 |
|
|
<STRONG>selectBorderWidth</STRONG> <STRONG>selectForeground</STRONG>
|
36 |
|
|
|
37 |
|
|
See the "options" manual entry for details on the standard
|
38 |
|
|
options.
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
</PRE>
|
42 |
|
|
<H2>ASSOCIATED OPTIONS</H2><PRE>
|
43 |
|
|
<STRONG>selectMode</STRONG>
|
44 |
|
|
|
45 |
|
|
See the "listbox" widget manual entry for details on the
|
46 |
|
|
above associated options.
|
47 |
|
|
|
48 |
|
|
<STRONG>activeRelief</STRONG> <STRONG>elementBorderwidth</STRONG> <STRONG>jumptroughColor</STRONG>
|
49 |
|
|
|
50 |
|
|
See the "scrollbar" widget manual entry for details on the
|
51 |
|
|
above associated options.
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
</PRE>
|
55 |
|
|
<H2>INHERITED OPTIONS</H2><PRE>
|
56 |
|
|
<STRONG>labeledBitmap</STRONG> <STRONG>labelFont</STRONG> <STRONG>labelImage</STRONG> <STRONG>labelMargin</STRONG>
|
57 |
|
|
<STRONG>labelPos</STRONG> <STRONG>labelText</STRONG> <STRONG>labelVariable</STRONG>
|
58 |
|
|
|
59 |
|
|
See the "labeledwidget" class manual entry for details on
|
60 |
|
|
the inherited options.
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
</PRE>
|
64 |
|
|
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
|
65 |
|
|
Name: <STRONG>dblClickCommand</STRONG>
|
66 |
|
|
Class: <STRONG>Command</STRONG>
|
67 |
|
|
Command-Line Switch: <STRONG>-dblclickcommand</STRONG>
|
68 |
|
|
|
69 |
|
|
Specifies a Tcl command procedure which is called when
|
70 |
|
|
an item is double clicked. Typically this occurs when
|
71 |
|
|
mouse button 1 is double clicked over an item. Selec-
|
72 |
|
|
tion policy does not matter.
|
73 |
|
|
|
74 |
|
|
Name: <STRONG>height</STRONG>
|
75 |
|
|
Class: <STRONG>Height</STRONG>
|
76 |
|
|
Command-Line Switch: <STRONG>-height</STRONG>
|
77 |
|
|
Specifies the height of the scrolled list box as an
|
78 |
|
|
entire unit. The value may be specified in any of the
|
79 |
|
|
forms acceptable to <STRONG>Tk_GetPixels</STRONG>. Any additional space
|
80 |
|
|
needed to display the other components such as labels,
|
81 |
|
|
margins, and scrollbars force the listbox to be
|
82 |
|
|
compressed. A value of zero along with the same value
|
83 |
|
|
for the width causes the value given for the visi-
|
84 |
|
|
bleitems option to be applied which administers
|
85 |
|
|
geometry constraints in a different manner. The
|
86 |
|
|
default height is zero.
|
87 |
|
|
|
88 |
|
|
Name: <STRONG>hscrollMode</STRONG>
|
89 |
|
|
Class: <STRONG>ScrollMode</STRONG>
|
90 |
|
|
Command-Line Switch: <STRONG>-hscrollmode</STRONG>
|
91 |
|
|
|
92 |
|
|
Specifies the the display mode to be used for the hor-
|
93 |
|
|
izontal scrollbar: <STRONG>static,</STRONG> <STRONG>dynamic,</STRONG> or <STRONG>none</STRONG>. In static
|
94 |
|
|
mode, the scroll bar is displayed at all times.
|
95 |
|
|
Dynamic mode displays the scroll bar as required, and
|
96 |
|
|
none disables the scroll bar display. The default is
|
97 |
|
|
static.
|
98 |
|
|
|
99 |
|
|
Name: <STRONG>items</STRONG>
|
100 |
|
|
Class: <STRONG>Items</STRONG>
|
101 |
|
|
Command-Line Switch: <STRONG>-items</STRONG>
|
102 |
|
|
|
103 |
|
|
Specifies the contents of the listbox as a proper list
|
104 |
|
|
of elements.
|
105 |
|
|
|
106 |
|
|
Name: <STRONG>sbWidth</STRONG>
|
107 |
|
|
Class: <STRONG>Width</STRONG>
|
108 |
|
|
Command-Line Switch: <STRONG>-sbwidth</STRONG>
|
109 |
|
|
|
110 |
|
|
Specifies the width of the scrollbar in any of the
|
111 |
|
|
forms acceptable to <STRONG>Tk_GetPixels</STRONG>. The default width is
|
112 |
|
|
15 pixels..
|
113 |
|
|
|
114 |
|
|
Name: <STRONG>scrollMargin</STRONG>
|
115 |
|
|
Class: <STRONG>Margin</STRONG>
|
116 |
|
|
Command-Line Switch: <STRONG>-scrollmargin</STRONG>
|
117 |
|
|
|
118 |
|
|
Specifies the distance between the listbox and
|
119 |
|
|
scrollbar in any of the forms acceptable to
|
120 |
|
|
<STRONG>Tk_GetPixels</STRONG>. The default is 3 pixels.
|
121 |
|
|
|
122 |
|
|
Name: <STRONG>selectionCommand</STRONG>
|
123 |
|
|
Class: <STRONG>Command</STRONG>
|
124 |
|
|
Command-Line Switch: <STRONG>-selectioncommand</STRONG>
|
125 |
|
|
|
126 |
|
|
Specifies a Tcl command procedure which is called when
|
127 |
|
|
an item is selected. Selection policy does not matter.
|
128 |
|
|
|
129 |
|
|
Name: <STRONG>textBackground</STRONG>
|
130 |
|
|
Class: <STRONG>Background</STRONG>
|
131 |
|
|
Command-Line Switch <STRONG>-textbackground</STRONG>
|
132 |
|
|
|
133 |
|
|
Specifies the background color for the listbox. This
|
134 |
|
|
allows the background within the listbox to be dif-
|
135 |
|
|
ferent from the normal background color.
|
136 |
|
|
|
137 |
|
|
Name: <STRONG>textFont</STRONG>
|
138 |
|
|
Class: <STRONG>Font</STRONG>
|
139 |
|
|
Command-Line Switch: <STRONG>-textfont</STRONG>
|
140 |
|
|
|
141 |
|
|
Specifies the font to be used for text in the listbox.
|
142 |
|
|
This allows for the font associated with text internal
|
143 |
|
|
to the scrolled listbox to be different than the font
|
144 |
|
|
for labels.
|
145 |
|
|
|
146 |
|
|
Name: <STRONG>visibleitems</STRONG>
|
147 |
|
|
Class: <STRONG>VisibleItems</STRONG>
|
148 |
|
|
Command-Line Switch: <STRONG>-visibleitems</STRONG>
|
149 |
|
|
|
150 |
|
|
Specifies the widthxheight in characters and lines for
|
151 |
|
|
the listbox. This option is only administered if the
|
152 |
|
|
width and height options are both set to zero, other-
|
153 |
|
|
wise they take precedence. The default value is 20x10.
|
154 |
|
|
With the visibleitems option engaged, geometry con-
|
155 |
|
|
straints are maintained only on the listbox. The size
|
156 |
|
|
of the other components such as labels, margins, and
|
157 |
|
|
scroll bars, are additive and independent, effecting
|
158 |
|
|
the overall size of the scrolled list box. In con-
|
159 |
|
|
trast, should the width and height options have non
|
160 |
|
|
zero values, they are applied to the scrolled list box
|
161 |
|
|
as a whole. The listbox is compressed or expanded to
|
162 |
|
|
maintain the geometry constraints.
|
163 |
|
|
|
164 |
|
|
Name: <STRONG>vscrollMode</STRONG>
|
165 |
|
|
Class: <STRONG>ScrollMode</STRONG>
|
166 |
|
|
Command-Line Switch: <STRONG>-vscrollmode</STRONG>
|
167 |
|
|
|
168 |
|
|
Specifies the the display mode to be used for the vert-
|
169 |
|
|
ical scrollbar: <STRONG>static,</STRONG> <STRONG>dynamic,</STRONG> or <STRONG>none</STRONG>. In static
|
170 |
|
|
mode, the scroll bar is displayed at all times.
|
171 |
|
|
Dynamic mode displays the scroll bar as required, and
|
172 |
|
|
none disables the scroll bar display. The default is
|
173 |
|
|
static.
|
174 |
|
|
|
175 |
|
|
Name: <STRONG>width</STRONG>
|
176 |
|
|
Class: <STRONG>Width</STRONG>
|
177 |
|
|
Command-Line Switch: <STRONG>-width</STRONG>
|
178 |
|
|
|
179 |
|
|
Specifies the width of the scrolled list box as an
|
180 |
|
|
entire unit. The value may be specified in any of the
|
181 |
|
|
forms acceptable to <STRONG>Tk_GetPixels</STRONG>. Any additional space
|
182 |
|
|
needed to display the other components such as labels,
|
183 |
|
|
margins, and scrollbars force the listbox to be
|
184 |
|
|
compressed. A value of zero along with the same value
|
185 |
|
|
for the height causes the value given for the visi-
|
186 |
|
|
bleitems option to be applied which administers
|
187 |
|
|
geometry constraints in a different manner. The
|
188 |
|
|
default width is zero.
|
189 |
|
|
|
190 |
|
|
</PRE>
|
191 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
</PRE>
|
196 |
|
|
<H2>DESCRIPTION</H2><PRE>
|
197 |
|
|
The <STRONG>scrolledlistbox</STRONG> command creates a scrolled listbox with
|
198 |
|
|
additional options to manage horizontal and vertical
|
199 |
|
|
scrollbars. This includes options to control which
|
200 |
|
|
scrollbars are displayed and the method, i.e. statically or
|
201 |
|
|
dynamically.
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
</PRE>
|
206 |
|
|
<H2>METHODS</H2><PRE>
|
207 |
|
|
The <STRONG>scrolledlistbox</STRONG> command creates a new Tcl command whose
|
208 |
|
|
name is <EM>pathName</EM>. This command may be used to invoke vari-
|
209 |
|
|
ous operations on the widget. It has the following general
|
210 |
|
|
form:
|
211 |
|
|
|
212 |
|
|
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
|
213 |
|
|
|
214 |
|
|
<EM>Option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
|
215 |
|
|
mand.
|
216 |
|
|
|
217 |
|
|
Many of the widget commands for a scrolledlistbox take as
|
218 |
|
|
one argument an indicator of which entry of the list box to
|
219 |
|
|
operate on. These indicators are called <EM>index</EM>es and may be
|
220 |
|
|
specified in any of the following forms:
|
221 |
|
|
|
222 |
|
|
<EM>number</EM> Specifies the element as a numerical index,
|
223 |
|
|
where 0 corresponds to the first element in the
|
224 |
|
|
listbox.
|
225 |
|
|
|
226 |
|
|
<STRONG>active</STRONG> Indicates the element that has the location cur-
|
227 |
|
|
sor. This element will be displayed with an
|
228 |
|
|
underline when the listbox has the keyboard
|
229 |
|
|
focus, and it is specified with the <STRONG>activate</STRONG>
|
230 |
|
|
widget command.
|
231 |
|
|
|
232 |
|
|
<STRONG>anchor</STRONG> Indicates the anchor point for the selection,
|
233 |
|
|
which is set with the <STRONG>selection</STRONG> <STRONG>anchor</STRONG> widget
|
234 |
|
|
command.
|
235 |
|
|
|
236 |
|
|
<STRONG>end</STRONG> Indicates the end of the listbox. For some com-
|
237 |
|
|
mands this means just after the last element;
|
238 |
|
|
for other commands it means the last element.
|
239 |
|
|
|
240 |
|
|
<STRONG>@</STRONG><EM>x</EM><STRONG>,</STRONG><EM>y</EM> Indicates the element that covers the point in
|
241 |
|
|
the listbox window specified by <EM>x</EM> and <EM>y</EM> (in
|
242 |
|
|
pixel coordinates). If no element covers that
|
243 |
|
|
point, then the closest element to that point is
|
244 |
|
|
used.
|
245 |
|
|
|
246 |
|
|
<EM>pattern</EM> If the index doesn't satisfy one of the above
|
247 |
|
|
forms then this form is used. <EM>Pattern</EM> is
|
248 |
|
|
pattern-matched against the items in the list
|
249 |
|
|
box, in order from the top down, until a match-
|
250 |
|
|
ing entry is found. The rules of
|
251 |
|
|
<STRONG>Tcl_StringMatch</STRONG> are used.
|
252 |
|
|
|
253 |
|
|
The following widget commands are possible for scrolledlist-
|
254 |
|
|
box widgets:
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
</PRE>
|
259 |
|
|
<H2>ASSOCIATED METHODS</H2><PRE>
|
260 |
|
|
<STRONG>activate</STRONG> <STRONG>bbox</STRONG> <STRONG>curselection</STRONG> <STRONG>delete</STRONG>
|
261 |
|
|
<STRONG>get</STRONG> <STRONG>index</STRONG> <STRONG>insert</STRONG> <STRONG>nearest</STRONG>
|
262 |
|
|
<STRONG>scan</STRONG> <STRONG>see</STRONG> <STRONG>selection</STRONG> <STRONG>size</STRONG>
|
263 |
|
|
<STRONG>xview</STRONG> <STRONG>yview</STRONG>
|
264 |
|
|
|
265 |
|
|
See the "listbox" manual entry for details on the associated
|
266 |
|
|
methods.
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
</PRE>
|
271 |
|
|
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
|
272 |
|
|
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
|
273 |
|
|
Returns the current value of the configuration option
|
274 |
|
|
given by <EM>option</EM>. <EM>Option</EM> may have any of the values
|
275 |
|
|
accepted by the <STRONG>scrolledlistbox</STRONG> command.
|
276 |
|
|
|
277 |
|
|
<EM>pathName</EM> <STRONG>clear</STRONG>
|
278 |
|
|
Clears the listbox of all items.
|
279 |
|
|
|
280 |
|
|
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
|
281 |
|
|
Query or modify the configuration options of the
|
282 |
|
|
widget. If no <EM>option</EM> is specified, returns a list
|
283 |
|
|
describing all of the available options for <EM>pathName</EM>
|
284 |
|
|
(see <STRONG>Tk_ConfigureInfo</STRONG> for information on the format of
|
285 |
|
|
this list). If <EM>option</EM> is specified with no <EM>value</EM>, then
|
286 |
|
|
the command returns a list describing the one named
|
287 |
|
|
option (this list will be identical to the correspond-
|
288 |
|
|
ing sublist of the value returned if no <EM>option</EM> is
|
289 |
|
|
specified). If one or more <EM>option</EM> - <EM>value</EM> pairs are
|
290 |
|
|
specified, then the command modifies the given widget
|
291 |
|
|
option(s) to have the given value(s); in this case the
|
292 |
|
|
command returns an empty string. <EM>Option</EM> may have any
|
293 |
|
|
of the values accepted by the <STRONG>scrolledlistbox</STRONG> command.
|
294 |
|
|
|
295 |
|
|
<EM>pathName</EM> <STRONG>getcurselection</STRONG>
|
296 |
|
|
Returns the contents of the listbox element indicated
|
297 |
|
|
by the current selection indexes. Short cut version of
|
298 |
|
|
get and curselection command combination.
|
299 |
|
|
|
300 |
|
|
<EM>pathName</EM> <STRONG>justify</STRONG> <EM>direction</EM>
|
301 |
|
|
Justifies the list contents via teh scroll bars in one
|
302 |
|
|
of four directions: <STRONG>left</STRONG>, <STRONG>right</STRONG>, <STRONG>top</STRONG>, or <STRONG>bottom</STRONG>.
|
303 |
|
|
|
304 |
|
|
<EM>pathName</EM> <STRONG>selecteditemcount</STRONG>
|
305 |
|
|
Returns the number of items currently selected in the
|
306 |
|
|
list.
|
307 |
|
|
|
308 |
|
|
<EM>pathName</EM> <STRONG>sort</STRONG> <EM>order</EM>
|
309 |
|
|
Sort the current list in either <STRONG>ascending</STRONG> or <STRONG>descending</STRONG>
|
310 |
|
|
order. The values <STRONG>increasing</STRONG> and <STRONG>decreasing</STRONG> are also
|
311 |
|
|
accepted.
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
</PRE>
|
316 |
|
|
<H2>COMPONENTS</H2><PRE>
|
317 |
|
|
Name: <STRONG>listbox</STRONG>
|
318 |
|
|
Class: <STRONG>listbox</STRONG>
|
319 |
|
|
|
320 |
|
|
The listbox component is the listbox widget. See the
|
321 |
|
|
"listbox" widget manual entry for details on the list-
|
322 |
|
|
box component item.
|
323 |
|
|
|
324 |
|
|
Name: <STRONG>horizsb</STRONG>
|
325 |
|
|
Class: <STRONG>Scrollbar</STRONG>
|
326 |
|
|
|
327 |
|
|
The horizsb component is the horizontal scroll bar.
|
328 |
|
|
See the "scrollbar" widget manual entry for details on
|
329 |
|
|
the horizsb component item.
|
330 |
|
|
|
331 |
|
|
Name: <STRONG>vertsb</STRONG>
|
332 |
|
|
Class: <STRONG>Scrollbar</STRONG>
|
333 |
|
|
|
334 |
|
|
The vertsb component is the vertical scroll bar. See
|
335 |
|
|
the "scrollbar" widget manual entry for details on the
|
336 |
|
|
vertsb component item.
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
</PRE>
|
341 |
|
|
<H2>EXAMPLE</H2><PRE>
|
342 |
|
|
wm minsize . 0 0
|
343 |
|
|
option add *textBackground white
|
344 |
|
|
proc selCmd {} {
|
345 |
|
|
puts stdout "[.slb getcurselection]"
|
346 |
|
|
}
|
347 |
|
|
proc defCmd {} {
|
348 |
|
|
puts stdout "Double Click"
|
349 |
|
|
return [selCmd]
|
350 |
|
|
}
|
351 |
|
|
scrolledlistbox .slb -selection single \
|
352 |
|
|
-items {Hello {Out There} World} \
|
353 |
|
|
-vscrollmode static -hscrollmode dynamic -labeltext "List" \
|
354 |
|
|
-selectioncommand selCmd -dblclickcommand defCmd
|
355 |
|
|
pack .slb -padx 10 -pady 10 -fill both -expand yes
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
</PRE>
|
360 |
|
|
<H2>AUTHOR</H2><PRE>
|
361 |
|
|
Mark L. Ulferts
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
</PRE>
|
365 |
|
|
<H2>KEYWORDS</H2><PRE>
|
366 |
|
|
scrolledlistbox, listbox, widget
|
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 |
|
|
</PRE>
|
409 |
|
|
</BODY>
|
410 |
|
|
</HTML>
|