1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1995 DSC Technologies Corporation
|
3 |
|
|
'\"
|
4 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
5 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
6 |
|
|
'\"
|
7 |
|
|
'\" @(#) scrolledlistbox.n 1.21 94/12/17 16:04:44
|
8 |
|
|
'/"
|
9 |
|
|
.so man.macros
|
10 |
|
|
.HS scrolledlistbox iwid
|
11 |
|
|
.BS
|
12 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
13 |
|
|
.SH NAME
|
14 |
|
|
scrolledlistbox \- Create and manipulate scrolled listbox widgets
|
15 |
|
|
.SH SYNOPSIS
|
16 |
|
|
\fBscrolledlistbox\fI \fIpathName \fR?\fIoptions\fR?
|
17 |
|
|
.SH "INHERITANCE"
|
18 |
|
|
itk::Widget <- Labeledwidget <- Scrolledwidget <- Scrolledlistbox
|
19 |
|
|
.SH "STANDARD OPTIONS"
|
20 |
|
|
.LP
|
21 |
|
|
.nf
|
22 |
|
|
.ta 4c 8c 12c
|
23 |
|
|
\fBactiveBackground\fR \fBbackground\fR \fBborderWidth\fR \fBcursor\fR
|
24 |
|
|
\fBexportSelection\fR \fBforeground\fR \fBhighlightColor\fR \fBhighlightThickness\fR
|
25 |
|
|
\fBrelief\fR \fBselectBackground\fR \fBselectBorderWidth\fR \fBselectForeground\fR
|
26 |
|
|
.fi
|
27 |
|
|
.LP
|
28 |
|
|
See the "options" manual entry for details on the standard options.
|
29 |
|
|
.SH "ASSOCIATED OPTIONS"
|
30 |
|
|
.LP
|
31 |
|
|
.nf
|
32 |
|
|
.ta 4c 8c 12c
|
33 |
|
|
\fBselectMode\fR
|
34 |
|
|
.fi
|
35 |
|
|
.LP
|
36 |
|
|
See the "listbox" widget manual entry for details on the above
|
37 |
|
|
associated options.
|
38 |
|
|
.LP
|
39 |
|
|
.nf
|
40 |
|
|
.ta 4c 8c 12c
|
41 |
|
|
\fBactiveRelief\fR \fBelementBorderwidth\fR \fBjump\fR \fBtroughColor\fR
|
42 |
|
|
.fi
|
43 |
|
|
.LP
|
44 |
|
|
See the "scrollbar" widget manual entry for details on the above
|
45 |
|
|
associated options.
|
46 |
|
|
.SH "INHERITED OPTIONS"
|
47 |
|
|
.LP
|
48 |
|
|
.nf
|
49 |
|
|
.ta 4c 8c 12c
|
50 |
|
|
\fBdisabledForeground\fR \fBlabelBitmap\fR \fBlabelFont\fR \fBlabelImage\fR
|
51 |
|
|
\fBlabelMargin\fR \fBlabelPos\fR \fBlabelText\fR \fBlabelVariable\fR
|
52 |
|
|
\fBstate\fR
|
53 |
|
|
.fi
|
54 |
|
|
.LP
|
55 |
|
|
See the "labeledwidget" class manual entry for details on the inherited
|
56 |
|
|
options.
|
57 |
|
|
.SH "WIDGET-SPECIFIC OPTIONS"
|
58 |
|
|
.LP
|
59 |
|
|
.nf
|
60 |
|
|
Name: \fBdblClickCommand\fR
|
61 |
|
|
Class: \fBCommand\fR
|
62 |
|
|
Command-Line Switch: \fB-dblclickcommand\fR
|
63 |
|
|
.fi
|
64 |
|
|
.IP
|
65 |
|
|
Specifies a Tcl command procedure which is called when an item is
|
66 |
|
|
double clicked. Typically this occurs when mouse button 1 is double
|
67 |
|
|
clicked over an item. Selection policy does not matter.
|
68 |
|
|
.LP
|
69 |
|
|
.nf
|
70 |
|
|
Name: \fBheight\fR
|
71 |
|
|
Class: \fBHeight\fR
|
72 |
|
|
Command-Line Switch: \fB-height\fR
|
73 |
|
|
.fi
|
74 |
|
|
.IP
|
75 |
|
|
Specifies the height of the scrolled list box as an entire unit.
|
76 |
|
|
The value may be specified in any of the forms acceptable to
|
77 |
|
|
\fBTk_GetPixels\fR. Any additional space needed to display the other
|
78 |
|
|
components such as labels, margins, and scrollbars force the listbox
|
79 |
|
|
to be compressed. A value of zero along with the same value for
|
80 |
|
|
the width causes the value given for the visibleitems option
|
81 |
|
|
to be applied which administers geometry constraints in a different
|
82 |
|
|
manner. The default height is zero.
|
83 |
|
|
.LP
|
84 |
|
|
.nf
|
85 |
|
|
Name: \fBhscrollMode\fR
|
86 |
|
|
Class: \fBScrollMode\fR
|
87 |
|
|
Command-Line Switch: \fB-hscrollmode\fR
|
88 |
|
|
.fi
|
89 |
|
|
.IP
|
90 |
|
|
Specifies the the display mode to be used for the horizontal
|
91 |
|
|
scrollbar: \fBstatic, dynamic,\fR or \fBnone\fR. In static mode, the
|
92 |
|
|
scroll bar is displayed at all times. Dynamic mode displays the
|
93 |
|
|
scroll bar as required, and none disables the scroll bar display. The
|
94 |
|
|
default is static.
|
95 |
|
|
.LP
|
96 |
|
|
.nf
|
97 |
|
|
Name: \fBsbWidth\fR
|
98 |
|
|
Class: \fBWidth\fR
|
99 |
|
|
Command-Line Switch: \fB-sbwidth\fR
|
100 |
|
|
.fi
|
101 |
|
|
.IP
|
102 |
|
|
Specifies the width of the scrollbar in any of the forms acceptable
|
103 |
|
|
to \fBTk_GetPixels\fR. The default width is 15 pixels..
|
104 |
|
|
.LP
|
105 |
|
|
.nf
|
106 |
|
|
Name: \fBscrollMargin\fR
|
107 |
|
|
Class: \fBMargin\fR
|
108 |
|
|
Command-Line Switch: \fB-scrollmargin\fR
|
109 |
|
|
.fi
|
110 |
|
|
.IP
|
111 |
|
|
Specifies the distance between the listbox and scrollbar in any of the
|
112 |
|
|
forms acceptable to \fBTk_GetPixels\fR. The default is 3 pixels.
|
113 |
|
|
.LP
|
114 |
|
|
.nf
|
115 |
|
|
Name: \fBselectionCommand\fR
|
116 |
|
|
Class: \fBCommand\fR
|
117 |
|
|
Command-Line Switch: \fB-selectioncommand\fR
|
118 |
|
|
.fi
|
119 |
|
|
.IP
|
120 |
|
|
Specifies a Tcl command procedure which is called when an item is
|
121 |
|
|
selected. Selection policy does not matter.
|
122 |
|
|
.LP
|
123 |
|
|
.nf
|
124 |
|
|
Name: \fBstate\fR
|
125 |
|
|
Class: \fBState\fR
|
126 |
|
|
Command-Line Switch: \fB-state\fR
|
127 |
|
|
.fi
|
128 |
|
|
.IP
|
129 |
|
|
Specifies one of two states for the listbox: \fBnormal\fR or \fBdisabled\fR.
|
130 |
|
|
If the listbox is disabled then selection is ignored. The default is
|
131 |
|
|
normal.
|
132 |
|
|
.LP
|
133 |
|
|
.nf
|
134 |
|
|
Name: \fBtextBackground\fR
|
135 |
|
|
Class: \fBBackground\fR
|
136 |
|
|
Command-Line Switch \fB-textbackground\fR
|
137 |
|
|
.fi
|
138 |
|
|
.IP
|
139 |
|
|
Specifies the background color for the listbox. This allows the background
|
140 |
|
|
within the listbox to be different from the normal background color.
|
141 |
|
|
.LP
|
142 |
|
|
.nf
|
143 |
|
|
Name: \fBtextFont\fR
|
144 |
|
|
Class: \fBFont\fR
|
145 |
|
|
Command-Line Switch: \fB-textfont\fR
|
146 |
|
|
.fi
|
147 |
|
|
.IP
|
148 |
|
|
Specifies the font to be used for text in the listbox. This allows for
|
149 |
|
|
the font associated with text internal to the scrolled listbox to be
|
150 |
|
|
different than the font for labels.
|
151 |
|
|
.LP
|
152 |
|
|
.nf
|
153 |
|
|
Name: \fBvisibleitems\fR
|
154 |
|
|
Class: \fBVisibleItems\fR
|
155 |
|
|
Command-Line Switch: \fB-visibleitems\fR
|
156 |
|
|
.fi
|
157 |
|
|
.IP
|
158 |
|
|
Specifies the widthxheight in characters and lines for the listbox.
|
159 |
|
|
This option is only administered if the width and height options
|
160 |
|
|
are both set to zero, otherwise they take precedence. The default value
|
161 |
|
|
is 20x10. With the visibleitems option engaged, geometry constraints
|
162 |
|
|
are maintained only on the listbox. The size of the other components such as
|
163 |
|
|
labels, margins, and scroll bars, are additive and independent,
|
164 |
|
|
effecting the overall size of the scrolled list box. In contrast,
|
165 |
|
|
should the width and height options have non zero values, they
|
166 |
|
|
are applied to the scrolled list box as a whole. The listbox
|
167 |
|
|
is compressed or expanded to maintain the geometry constraints.
|
168 |
|
|
.LP
|
169 |
|
|
.nf
|
170 |
|
|
Name: \fBvscrollMode\fR
|
171 |
|
|
Class: \fBScrollMode\fR
|
172 |
|
|
Command-Line Switch: \fB-vscrollmode\fR
|
173 |
|
|
.fi
|
174 |
|
|
.IP
|
175 |
|
|
Specifies the the display mode to be used for the vertical
|
176 |
|
|
scrollbar: \fBstatic, dynamic,\fR or \fBnone\fR. In static mode, the
|
177 |
|
|
scroll bar is displayed at all times. Dynamic mode displays the
|
178 |
|
|
scroll bar as required, and none disables the scroll bar display. The
|
179 |
|
|
default is static.
|
180 |
|
|
.LP
|
181 |
|
|
.nf
|
182 |
|
|
Name: \fBwidth\fR
|
183 |
|
|
Class: \fBWidth\fR
|
184 |
|
|
Command-Line Switch: \fB-width\fR
|
185 |
|
|
.fi
|
186 |
|
|
.IP
|
187 |
|
|
Specifies the width of the scrolled list box as an entire unit.
|
188 |
|
|
The value may be specified in any of the forms acceptable to
|
189 |
|
|
\fBTk_GetPixels\fR. Any additional space needed to display the other
|
190 |
|
|
components such as labels, margins, and scrollbars force the listbox
|
191 |
|
|
to be compressed. A value of zero along with the same value for
|
192 |
|
|
the height causes the value given for the visibleitems option
|
193 |
|
|
to be applied which administers geometry constraints in a different
|
194 |
|
|
manner. The default width is zero.
|
195 |
|
|
.BE
|
196 |
|
|
|
197 |
|
|
.SH DESCRIPTION
|
198 |
|
|
.PP
|
199 |
|
|
The \fBscrolledlistbox\fR command creates
|
200 |
|
|
a scrolled listbox with additional options to manage
|
201 |
|
|
horizontal and vertical scrollbars. This includes options to control
|
202 |
|
|
which scrollbars are displayed and the method, i.e. statically or
|
203 |
|
|
dynamically.
|
204 |
|
|
|
205 |
|
|
.SH "METHODS"
|
206 |
|
|
.PP
|
207 |
|
|
The \fBscrolledlistbox\fR command creates a new Tcl command whose
|
208 |
|
|
name is \fIpathName\fR. This
|
209 |
|
|
command may be used to invoke various
|
210 |
|
|
operations on the widget. It has the following general form:
|
211 |
|
|
.DS C
|
212 |
|
|
\fIpathName option \fR?\fIarg arg ...\fR?
|
213 |
|
|
.DE
|
214 |
|
|
\fIOption\fR and the \fIarg\fRs
|
215 |
|
|
determine the exact behavior of the command.
|
216 |
|
|
.PP
|
217 |
|
|
Many of the widget commands for a scrolledlistbox take as one argument an
|
218 |
|
|
indicator of which entry of the list box to operate on. These
|
219 |
|
|
indicators are called \fIindex\fRes and may be specified in
|
220 |
|
|
any of the following forms:
|
221 |
|
|
.TP 12
|
222 |
|
|
\fInumber\fR
|
223 |
|
|
Specifies the element as a numerical index, where 0 corresponds
|
224 |
|
|
to the first element in the listbox.
|
225 |
|
|
.TP 12
|
226 |
|
|
\fBactive\fR
|
227 |
|
|
Indicates the element that has the location cursor. This element
|
228 |
|
|
will be displayed with an underline when the listbox has the
|
229 |
|
|
keyboard focus, and it is specified with the \fBactivate\fR
|
230 |
|
|
widget command.
|
231 |
|
|
.TP 12
|
232 |
|
|
\fBanchor\fR
|
233 |
|
|
Indicates the anchor point for the selection, which is set with the
|
234 |
|
|
\fBselection anchor\fR widget command.
|
235 |
|
|
.TP 12
|
236 |
|
|
\fBend\fR
|
237 |
|
|
Indicates the end of the listbox.
|
238 |
|
|
For some commands this means just after the last element;
|
239 |
|
|
for other commands it means the last element.
|
240 |
|
|
.TP 12
|
241 |
|
|
\fB@\fIx\fB,\fIy\fR
|
242 |
|
|
Indicates the element that covers the point in the listbox window
|
243 |
|
|
specified by \fIx\fR and \fIy\fR (in pixel coordinates). If no
|
244 |
|
|
element covers that point, then the closest element to that
|
245 |
|
|
point is used.
|
246 |
|
|
.TP 12
|
247 |
|
|
\fIpattern\fR
|
248 |
|
|
If the index doesn't satisfy one of the above forms then this
|
249 |
|
|
form is used. \fIPattern\fR is pattern-matched against the items in
|
250 |
|
|
the list box, in order from the top down, until a matching entry is found.
|
251 |
|
|
The rules of \fBTcl_StringMatch\fR are used.
|
252 |
|
|
.PP
|
253 |
|
|
The following widget commands are possible for scrolledlistbox widgets:
|
254 |
|
|
|
255 |
|
|
.SH "ASSOCIATED METHODS"
|
256 |
|
|
.LP
|
257 |
|
|
.nf
|
258 |
|
|
.ta 4c 8c 12c
|
259 |
|
|
\fBactivate\fR \fBbbox\fR \fBcurselection\fR \fBdelete\fR
|
260 |
|
|
\fBget\fR \fBindex\fR \fBinsert\fR \fBnearest\fR
|
261 |
|
|
\fBscan\fR \fBsee\fR \fBselection\fR \fBsize\fR
|
262 |
|
|
\fBxview\fR \fByview\fR
|
263 |
|
|
.fi
|
264 |
|
|
.LP
|
265 |
|
|
See the "listbox" manual entry for details on the associated methods.
|
266 |
|
|
|
267 |
|
|
.SH "WIDGET-SPECIFIC METHODS"
|
268 |
|
|
.TP
|
269 |
|
|
\fIpathName \fBcget\fR \fIoption\fR
|
270 |
|
|
Returns the current value of the configuration option given
|
271 |
|
|
by \fIoption\fR.
|
272 |
|
|
\fIOption\fR may have any of the values accepted by the \fBscrolledlistbox\fR
|
273 |
|
|
command.
|
274 |
|
|
.TP
|
275 |
|
|
\fIpathName \fBclear\fR
|
276 |
|
|
Clears the listbox of all items.
|
277 |
|
|
.TP
|
278 |
|
|
\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
|
279 |
|
|
Query or modify the configuration options of the widget.
|
280 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
281 |
|
|
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
|
282 |
|
|
information on the format of this list). If \fIoption\fR is specified
|
283 |
|
|
with no \fIvalue\fR, then the command returns a list describing the
|
284 |
|
|
one named option (this list will be identical to the corresponding
|
285 |
|
|
sublist of the value returned if no \fIoption\fR is specified). If
|
286 |
|
|
one or more \fIoption\-value\fR pairs are specified, then the command
|
287 |
|
|
modifies the given widget option(s) to have the given value(s); in
|
288 |
|
|
this case the command returns an empty string.
|
289 |
|
|
\fIOption\fR may have any of the values accepted by the \fBscrolledlistbox\fR
|
290 |
|
|
command.
|
291 |
|
|
.TP
|
292 |
|
|
\fIpathName \fBgetcurselection\fR
|
293 |
|
|
Returns the contents of the listbox element indicated by the current
|
294 |
|
|
selection indexes. Short cut version of get and curselection command
|
295 |
|
|
combination.
|
296 |
|
|
.TP
|
297 |
|
|
\fIpathName \fBjustify \fIdirection\fR
|
298 |
|
|
Justifies the list contents via teh scroll bars in one of four directions:
|
299 |
|
|
\fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
|
300 |
|
|
.TP
|
301 |
|
|
\fIpathName \fBselecteditemcount\fR
|
302 |
|
|
Returns the number of items currently selected in the list.
|
303 |
|
|
.TP
|
304 |
|
|
\fIpathName \fBsort\fR \fIorder\fR
|
305 |
|
|
Sort the current list in either \fBascending\fR or \fBdescending\fR order.
|
306 |
|
|
The values \fBincreasing\fR and \fBdecreasing\fR are also accepted.
|
307 |
|
|
|
308 |
|
|
.SH "COMPONENTS"
|
309 |
|
|
.LP
|
310 |
|
|
.nf
|
311 |
|
|
Name: \fBlistbox\fR
|
312 |
|
|
Class: \fBlistbox\fR
|
313 |
|
|
.fi
|
314 |
|
|
.IP
|
315 |
|
|
The listbox component is the listbox widget. See the "listbox" widget
|
316 |
|
|
manual entry for details on the listbox component item.
|
317 |
|
|
.LP
|
318 |
|
|
.nf
|
319 |
|
|
Name: \fBhorizsb\fR
|
320 |
|
|
Class: \fBScrollbar\fR
|
321 |
|
|
.fi
|
322 |
|
|
.IP
|
323 |
|
|
The horizsb component is the horizontal scroll bar. See the "scrollbar"
|
324 |
|
|
widget manual entry for details on the horizsb component item.
|
325 |
|
|
.LP
|
326 |
|
|
.nf
|
327 |
|
|
Name: \fBvertsb\fR
|
328 |
|
|
Class: \fBScrollbar\fR
|
329 |
|
|
.fi
|
330 |
|
|
.IP
|
331 |
|
|
The vertsb component is the vertical scroll bar. See the "scrollbar" widget
|
332 |
|
|
manual entry for details on the vertsb component item.
|
333 |
|
|
.fi
|
334 |
|
|
|
335 |
|
|
.SH EXAMPLE
|
336 |
|
|
.DS
|
337 |
|
|
option add *textBackground white
|
338 |
|
|
proc selCmd {} {
|
339 |
|
|
puts stdout "[.slb getcurselection]"
|
340 |
|
|
}
|
341 |
|
|
proc defCmd {} {
|
342 |
|
|
puts stdout "Double Click"
|
343 |
|
|
return [selCmd]
|
344 |
|
|
}
|
345 |
|
|
scrolledlistbox .slb -selection single \\
|
346 |
|
|
-vscrollmode static -hscrollmode dynamic -labeltext "List" \\
|
347 |
|
|
-selectioncommand selCmd -dblclickcommand defCmd
|
348 |
|
|
pack .slb -padx 10 -pady 10 -fill both -expand yes
|
349 |
|
|
.slb insert end {Hello {Out There} World}
|
350 |
|
|
.DE
|
351 |
|
|
.SH AUTHOR
|
352 |
|
|
Mark L. Ulferts
|
353 |
|
|
.SH KEYWORDS
|
354 |
|
|
scrolledlistbox, listbox, widget
|