Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "LISTBOX 1" | |
132 | .TH LISTBOX 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::Listbox \- Create and manipulate Listbox widgets | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\fI$listbox\fR = \fI$parent\fR\->\fBListbox\fR(?\fIoptions\fR?); | |
138 | .SH "STANDARD OPTIONS" | |
139 | .IX Header "STANDARD OPTIONS" | |
140 | \&\fB\-background\fR \fB\-foreground\fR \fB\-relief\fR \fB\-takefocus\fR | |
141 | \&\fB\-borderwidth\fR \fB\-height\fR \fB\-selectbackground\fR \fB\-width\fR | |
142 | \&\fB\-cursor\fR \fB\-highlightbackground\fR \fB\-selectborderwidth\fR \fB\-xscrollcommand\fR | |
143 | \&\fB\-exportselection\fR \fB\-highlightcolor\fR \fB\-selectforeground\fR \fB\-yscrollcommand\fR | |
144 | \&\fB\-font\fR \fB\-highlightthickness\fR \fB\-setgrid\fR | |
145 | .PP | |
146 | See Tk::options for details of the standard options. | |
147 | .SH "WIDGET-SPECIFIC OPTIONS" | |
148 | .IX Header "WIDGET-SPECIFIC OPTIONS" | |
149 | .IP "Name: \fBheight\fR" 4 | |
150 | .IX Item "Name: height" | |
151 | .PD 0 | |
152 | .IP "Class: \fBHeight\fR" 4 | |
153 | .IX Item "Class: Height" | |
154 | .IP "Switch: \fB\-height\fR" 4 | |
155 | .IX Item "Switch: -height" | |
156 | .PD | |
157 | Specifies the desired height for the window, in lines. | |
158 | If zero or less, then the desired height for the window is made just | |
159 | large enough to hold all the elements in the listbox. | |
160 | .IP "Name: \fBselectMode\fR" 4 | |
161 | .IX Item "Name: selectMode" | |
162 | .PD 0 | |
163 | .IP "Class: \fBSelectMode\fR" 4 | |
164 | .IX Item "Class: SelectMode" | |
165 | .IP "Switch: \fB\-selectmode\fR" 4 | |
166 | .IX Item "Switch: -selectmode" | |
167 | .PD | |
168 | Specifies one of several styles for manipulating the selection. | |
169 | The value of the option may be arbitrary, but the default bindings | |
170 | expect it to be either \fBsingle\fR, \fBbrowse\fR, \fBmultiple\fR, | |
171 | or \fBextended\fR; the default value is \fBbrowse\fR. | |
172 | .IP "Name: \fBwidth\fR" 4 | |
173 | .IX Item "Name: width" | |
174 | .PD 0 | |
175 | .IP "Class: \fBWidth\fR" 4 | |
176 | .IX Item "Class: Width" | |
177 | .IP "Switch: \fB\-width\fR" 4 | |
178 | .IX Item "Switch: -width" | |
179 | .PD | |
180 | Specifies the desired width for the window in characters. | |
181 | If the font doesn't have a uniform width then the width of the | |
182 | character ``0'' is used in translating from character units to | |
183 | screen units. | |
184 | If zero or less, then the desired width for the window is made just | |
185 | large enough to hold all the elements in the listbox. | |
186 | .SH "DESCRIPTION" | |
187 | .IX Header "DESCRIPTION" | |
188 | The \fBListbox\fR method creates a new window (given by the | |
189 | \&\f(CW$widget\fR argument) and makes it into a listbox widget. | |
190 | Additional | |
191 | options, described above, may be specified on the command line | |
192 | or in the option database | |
193 | to configure aspects of the listbox such as its colors, font, | |
194 | text, and relief. The \fBlistbox\fR command returns its | |
195 | \&\f(CW$widget\fR argument. At the time this command is invoked, | |
196 | there must not exist a window named \f(CW$widget\fR, but | |
197 | \&\f(CW$widget\fR's parent must exist. | |
198 | .PP | |
199 | A listbox is a widget that displays a list of strings, one per line. | |
200 | When first created, a new listbox has no elements. | |
201 | Elements may be added or deleted using methods described | |
202 | below. In addition, one or more elements may be selected as described | |
203 | below. | |
204 | If a listbox is exporting its selection (see \fBexportSelection\fR | |
205 | option), then it will observe the standard X11 protocols | |
206 | for handling the selection. | |
207 | Listbox selections are available as type \fB\s-1STRING\s0\fR; | |
208 | the value of the selection will be the text of the selected elements, with | |
209 | newlines separating the elements. | |
210 | .PP | |
211 | It is not necessary for all the elements to be | |
212 | displayed in the listbox window at once; commands described below | |
213 | may be used to change the view in the window. Listboxes allow | |
214 | scrolling in both directions using the standard \fBxScrollCommand\fR | |
215 | and \fByScrollCommand\fR options. | |
216 | They also support scanning, as described below. | |
217 | .SH "INDICES" | |
218 | .IX Header "INDICES" | |
219 | Many of the methods for listboxes take one or more indices | |
220 | as arguments. | |
221 | An index specifies a particular element of the listbox, in any of | |
222 | the following ways: | |
223 | .IP "\fInumber\fR" 4 | |
224 | .IX Item "number" | |
225 | Specifies the element as a numerical index, where 0 corresponds | |
226 | to the first element in the listbox. | |
227 | .IP "\fBactive\fR" 4 | |
228 | .IX Item "active" | |
229 | Indicates the element that has the location cursor. This element | |
230 | will be displayed with an underline when the listbox has the | |
231 | keyboard focus, and it is specified with the \fBactivate\fR | |
232 | method. | |
233 | .IP "\fBanchor\fR" 4 | |
234 | .IX Item "anchor" | |
235 | Indicates the anchor point for the selection, which is set with the | |
236 | \&\fBselection anchor\fR method. | |
237 | .IP "\fBend\fR" 4 | |
238 | .IX Item "end" | |
239 | Indicates the end of the listbox. | |
240 | For most commands this refers to the last element in the listbox, | |
241 | but for a few commands such as \fBindex\fR and \fBinsert\fR | |
242 | it refers to the element just after the last one. | |
243 | .IP "\fB@\fR\fIx\fR\fB,\fR\fIy\fR" 4 | |
244 | .IX Item "@x,y" | |
245 | Indicates the element that covers the point in the listbox window | |
246 | specified by \fIx\fR and \fIy\fR (in pixel coordinates). If no | |
247 | element covers that point, then the closest element to that | |
248 | point is used. | |
249 | .PP | |
250 | In the method descriptions below, arguments named \fIindex\fR, | |
251 | \&\fIfirst\fR, and \fIlast\fR always contain text indices in one of | |
252 | the above forms. | |
253 | .SH "WIDGET METHODS" | |
254 | .IX Header "WIDGET METHODS" | |
255 | The \fBListbox\fR method creates a widget object. | |
256 | This object supports the \fBconfigure\fR and \fBcget\fR methods | |
257 | described in Tk::options which can be used to enquire and | |
258 | modify the options described above. | |
259 | The widget also inherits all the methods provided by the generic | |
260 | Tk::Widget class. | |
261 | .PP | |
262 | The following additional methods are available for listbox widgets: | |
263 | .IP "\fI$listbox\fR\->\fBactivate\fR(\fIindex\fR)" 4 | |
264 | .IX Item "$listbox->activate(index)" | |
265 | Sets the active element to the one indicated by \fIindex\fR. | |
266 | If \fIindex\fR is outside the range of elements in the listbox | |
267 | then the closest element is activated. | |
268 | The active element is drawn with an underline when the widget | |
269 | has the input focus, and its index may be retrieved with the | |
270 | index \fBactive\fR. | |
271 | .IP "\fI$listbox\fR\->\fBbbox\fR(\fIindex\fR)" 4 | |
272 | .IX Item "$listbox->bbox(index)" | |
273 | Returns a list of four numbers describing the bounding box of | |
274 | the text in the element given by \fIindex\fR. | |
275 | The first two elements of the list give the x and y coordinates | |
276 | of the upper-left corner of the screen area covered by the text | |
277 | (specified in pixels relative to the widget) and the last two | |
278 | elements give the width and height of the area, in pixels. | |
279 | If no part of the element given by \fIindex\fR is visible on the | |
280 | screen, | |
281 | or if \fIindex\fR refers to a non-existent element, | |
282 | then the result is an empty string; if the element is | |
283 | partially visible, the result gives the full area of the element, | |
284 | including any parts that are not visible. | |
285 | .IP "\fI$listbox\fR\->\fBcurselection\fR" 4 | |
286 | .IX Item "$listbox->curselection" | |
287 | Returns a list containing the numerical indices of | |
288 | all of the elements in the listbox that are currently selected. | |
289 | If there are no elements selected in the listbox then an empty | |
290 | string is returned. | |
291 | .IP "\fI$listbox\fR\->\fBdelete\fR(\fIfirst, \fR?\fIlast\fR?)" 4 | |
292 | .IX Item "$listbox->delete(first, ?last?)" | |
293 | Deletes one or more elements of the listbox. \fIFirst\fR and \fIlast\fR | |
294 | are indices specifying the first and last elements in the range | |
295 | to delete. If \fIlast\fR isn't specified it defaults to | |
296 | \&\fIfirst\fR, i.e. a single element is deleted. | |
297 | .IP "\fI$listbox\fR\->\fBget\fR(\fIfirst, \fR?\fIlast\fR?)" 4 | |
298 | .IX Item "$listbox->get(first, ?last?)" | |
299 | If \fIlast\fR is omitted, returns the contents of the listbox | |
300 | element indicated by \fIfirst\fR, | |
301 | or an empty string if \fIfirst\fR refers to a non-existent element. | |
302 | If \fIlast\fR is specified, the command returns a list whose elements | |
303 | are all of the listbox elements between \fIfirst\fR and \fIlast\fR, | |
304 | inclusive. | |
305 | Both \fIfirst\fR and \fIlast\fR may have any of the standard | |
306 | forms for indices. | |
307 | .IP "\fI$listbox\fR\->\fBindex\fR(\fIindex\fR)" 4 | |
308 | .IX Item "$listbox->index(index)" | |
309 | Returns the integer index value that corresponds to \fIindex\fR. | |
310 | If \fIindex\fR is \fBend\fR the return value is a count of the number | |
311 | of elements in the listbox (not the index of the last element). | |
312 | .IP "\fI$listbox\fR\->\fBinsert\fR(\fIindex, \fR?\fIelement, element, ...\fR?)" 4 | |
313 | .IX Item "$listbox->insert(index, ?element, element, ...?)" | |
314 | Inserts zero or more new elements in the list just before the | |
315 | element given by \fIindex\fR. If \fIindex\fR is specified as | |
316 | \&\fBend\fR then the new elements are added to the end of the | |
317 | list. Returns an empty string. | |
318 | .IP "\fI$listbox\fR\->\fBnearest\fR(\fIy\fR)" 4 | |
319 | .IX Item "$listbox->nearest(y)" | |
320 | Given a y\-coordinate within the listbox window, this command returns | |
321 | the index of the (visible) listbox element nearest to that y\-coordinate. | |
322 | .IP "\fI$listbox\fR\->\fBscan\fR(\fIoption, args\fR)" 4 | |
323 | .IX Item "$listbox->scan(option, args)" | |
324 | This command is used to implement scanning on listboxes. It has | |
325 | two forms, depending on \fIoption\fR: | |
326 | .RS 4 | |
327 | .IP "\fI$listbox\fR\->\fBscanMark\fR(\fIx, y\fR)" 8 | |
328 | .IX Item "$listbox->scanMark(x, y)" | |
329 | Records \fIx\fR and \fIy\fR and the current view in the listbox | |
330 | window; used in conjunction with later \fBscan dragto\fR commands. | |
331 | Typically this command is associated with a mouse button press in | |
332 | the widget. It returns an empty string. | |
333 | .IP "\fI$listbox\fR\->\fBscanDragto\fR(\fIx, y\fR.)" 8 | |
334 | .IX Item "$listbox->scanDragto(x, y.)" | |
335 | This command computes the difference between its \fIx\fR and \fIy\fR | |
336 | arguments and the \fIx\fR and \fIy\fR arguments to the last | |
337 | \&\fBscan mark\fR command for the widget. | |
338 | It then adjusts the view by 10 times the | |
339 | difference in coordinates. This command is typically associated | |
340 | with mouse motion events in the widget, to produce the effect of | |
341 | dragging the list at high speed through the window. The return | |
342 | value is an empty string. | |
343 | .RE | |
344 | .RS 4 | |
345 | .RE | |
346 | .IP "\fI$listbox\fR\->\fBsee\fR(\fIindex\fR)" 4 | |
347 | .IX Item "$listbox->see(index)" | |
348 | Adjust the view in the listbox so that the element given by \fIindex\fR | |
349 | is visible. | |
350 | If the element is already visible then the command has no effect; | |
351 | if the element is near one edge of the window then the listbox | |
352 | scrolls to bring the element into view at the edge; otherwise | |
353 | the listbox scrolls to center the element. | |
354 | .IP "\fI$listbox\fR\->\fBselection\fR(\fIoption, arg\fR)" 4 | |
355 | .IX Item "$listbox->selection(option, arg)" | |
356 | This command is used to adjust the selection within a listbox. It | |
357 | has several forms, depending on \fIoption\fR: | |
358 | .RS 4 | |
359 | .IP "\fI$listbox\fR\->\fBselectionAnchor\fR(\fIindex\fR)" 8 | |
360 | .IX Item "$listbox->selectionAnchor(index)" | |
361 | Sets the selection anchor to the element given by \fIindex\fR. | |
362 | If \fIindex\fR refers to a non-existent element, then the closest | |
363 | element is used. | |
364 | The selection anchor is the end of the selection that is fixed | |
365 | while dragging out a selection with the mouse. | |
366 | The index \fBanchor\fR may be used to refer to the anchor | |
367 | element. | |
368 | .IP "\fI$listbox\fR\->\fBselectionClear\fR(\fIfirst, \fR?\fIlast\fR?)" 8 | |
369 | .IX Item "$listbox->selectionClear(first, ?last?)" | |
370 | If any of the elements between \fIfirst\fR and \fIlast\fR | |
371 | (inclusive) are selected, they are deselected. | |
372 | The selection state is not changed for elements outside | |
373 | this range. | |
374 | .IP "\fI$listbox\fR\->\fBselectionIncludes\fR(\fIindex\fR)" 8 | |
375 | .IX Item "$listbox->selectionIncludes(index)" | |
376 | Returns 1 if the element indicated by \fIindex\fR is currently | |
377 | selected, 0 if it isn't. | |
378 | .IP "\fI$listbox\fR\->\fBselectionSet\fR(\fIfirst, \fR?\fIlast\fR?)" 8 | |
379 | .IX Item "$listbox->selectionSet(first, ?last?)" | |
380 | Selects all of the elements in the range between | |
381 | \&\fIfirst\fR and \fIlast\fR, inclusive, without affecting | |
382 | the selection state of elements outside that range. | |
383 | .RE | |
384 | .RS 4 | |
385 | .RE | |
386 | .IP "\fI$listbox\fR\->\fBsize\fR" 4 | |
387 | .IX Item "$listbox->size" | |
388 | Returns a decimal string indicating the total number of elements | |
389 | in the listbox. | |
390 | .IP "\fI$listbox\fR\->\fBxview\fR(\fIargs\fR)" 4 | |
391 | .IX Item "$listbox->xview(args)" | |
392 | This command is used to query and change the horizontal position of the | |
393 | information in the widget's window. It can take any of the following | |
394 | forms: | |
395 | .RS 4 | |
396 | .IP "\fI$listbox\fR\->\fBxview\fR" 8 | |
397 | .IX Item "$listbox->xview" | |
398 | Returns a list containing two elements. | |
399 | Each element is a real fraction between 0 and 1; together they describe | |
400 | the horizontal span that is visible in the window. | |
401 | For example, if the first element is .2 and the second element is .6, | |
402 | 20% of the listbox's text is off-screen to the left, the middle 40% is visible | |
403 | in the window, and 40% of the text is off-screen to the right. | |
404 | These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR | |
405 | option. | |
406 | .IP "\fI$listbox\fR\->\fBxview\fR(\fIindex\fR)" 8 | |
407 | .IX Item "$listbox->xview(index)" | |
408 | Adjusts the view in the window so that the character position given by | |
409 | \&\fIindex\fR is displayed at the left edge of the window. | |
410 | Character positions are defined by the width of the character \fB0\fR. | |
411 | .IP "\fI$listbox\fR\->\fBxview\fR(\fBmoveto\fR => \fIfraction\fR)" 8 | |
412 | .IX Item "$listbox->xview(moveto => fraction)" | |
413 | Adjusts the view in the window so that \fIfraction\fR of the | |
414 | total width of the listbox text is off-screen to the left. | |
415 | \&\fIfraction\fR must be a fraction between 0 and 1. | |
416 | .IP "\fI$listbox\fR\->\fBxview\fR(\fBscroll\fR => \fInumber, what\fR)" 8 | |
417 | .IX Item "$listbox->xview(scroll => number, what)" | |
418 | This command shifts the view in the window left or right according to | |
419 | \&\fInumber\fR and \fIwhat\fR. | |
420 | \&\fINumber\fR must be an integer. | |
421 | \&\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation | |
422 | of one of these. | |
423 | If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by | |
424 | \&\fInumber\fR character units (the width of the \fB0\fR character) | |
425 | on the display; if it is \fBpages\fR then the view adjusts by | |
426 | \&\fInumber\fR screenfuls. | |
427 | If \fInumber\fR is negative then characters farther to the left | |
428 | become visible; if it is positive then characters farther to the right | |
429 | become visible. | |
430 | .RE | |
431 | .RS 4 | |
432 | .RE | |
433 | .IP "\fI$listbox\fR\->\fByview\fR(\fI?args\fR?)" 4 | |
434 | .IX Item "$listbox->yview(?args?)" | |
435 | This command is used to query and change the vertical position of the | |
436 | text in the widget's window. | |
437 | It can take any of the following forms: | |
438 | .RS 4 | |
439 | .IP "\fI$listbox\fR\->\fByview\fR" 8 | |
440 | .IX Item "$listbox->yview" | |
441 | Returns a list containing two elements, both of which are real fractions | |
442 | between 0 and 1. | |
443 | The first element gives the position of the listbox element at the | |
444 | top of the window, relative to the listbox as a whole (0.5 means | |
445 | it is halfway through the listbox, for example). | |
446 | The second element gives the position of the listbox element just after | |
447 | the last one in the window, relative to the listbox as a whole. | |
448 | These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR | |
449 | option. | |
450 | .IP "\fI$listbox\fR\->\fByview\fR(\fIindex\fR)" 8 | |
451 | .IX Item "$listbox->yview(index)" | |
452 | Adjusts the view in the window so that the element given by | |
453 | \&\fIindex\fR is displayed at the top of the window. | |
454 | .IP "\fI$listbox\fR\->\fByview\fR(\fBmoveto\fR => \fIfraction\fR)" 8 | |
455 | .IX Item "$listbox->yview(moveto => fraction)" | |
456 | Adjusts the view in the window so that the element given by \fIfraction\fR | |
457 | appears at the top of the window. | |
458 | \&\fIFraction\fR is a fraction between 0 and 1; 0 indicates the first | |
459 | element in the listbox, 0.33 indicates the element one-third the | |
460 | way through the listbox, and so on. | |
461 | .IP "\fI$listbox\fR\->\fByview\fR(\fBscroll\fR => \fInumber, what\fR)" 8 | |
462 | .IX Item "$listbox->yview(scroll => number, what)" | |
463 | This command adjusts the view in the window up or down according to | |
464 | \&\fInumber\fR and \fIwhat\fR. | |
465 | \&\fINumber\fR must be an integer. | |
466 | \&\fIWhat\fR must be either \fBunits\fR or \fBpages\fR. | |
467 | If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by | |
468 | \&\fInumber\fR lines; if it is \fBpages\fR then | |
469 | the view adjusts by \fInumber\fR screenfuls. | |
470 | If \fInumber\fR is negative then earlier elements | |
471 | become visible; if it is positive then later elements | |
472 | become visible. | |
473 | .RE | |
474 | .RS 4 | |
475 | .RE | |
476 | .SH "DEFAULT BINDINGS" | |
477 | .IX Header "DEFAULT BINDINGS" | |
478 | Tk automatically creates class bindings for listboxes that give them | |
479 | Motif-like behavior. Much of the behavior of a listbox is determined | |
480 | by its \fBselectMode\fR option, which selects one of four ways | |
481 | of dealing with the selection. | |
482 | .PP | |
483 | If the selection mode is \fBsingle\fR or \fBbrowse\fR, at most one | |
484 | element can be selected in the listbox at once. | |
485 | In both modes, clicking button 1 on an element selects | |
486 | it and deselects any other selected item. | |
487 | In \fBbrowse\fR mode it is also possible to drag the selection | |
488 | with button 1. | |
489 | .PP | |
490 | If the selection mode is \fBmultiple\fR or \fBextended\fR, | |
491 | any number of elements may be selected at once, including discontiguous | |
492 | ranges. In \fBmultiple\fR mode, clicking button 1 on an element | |
493 | toggles its selection state without affecting any other elements. | |
494 | In \fBextended\fR mode, pressing button 1 on an element selects | |
495 | it, deselects everything else, and sets the anchor to the element | |
496 | under the mouse; dragging the mouse with button 1 | |
497 | down extends the selection to include all the elements between | |
498 | the anchor and the element under the mouse, inclusive. | |
499 | .PP | |
500 | Most people will probably want to use \fBbrowse\fR mode for | |
501 | single selections and \fBextended\fR mode for multiple selections; | |
502 | the other modes appear to be useful only in special situations. | |
503 | .PP | |
504 | In addition to the above behavior, the following additional behavior | |
505 | is defined by the default bindings: | |
506 | .IP "[1]" 4 | |
507 | .IX Item "[1]" | |
508 | In \fBextended\fR mode, the selected range can be adjusted by pressing | |
509 | button 1 with the Shift key down: this modifies the selection to | |
510 | consist of the elements between the anchor and the element under | |
511 | the mouse, inclusive. | |
512 | The un-anchored end of this new selection can also be dragged with | |
513 | the button down. | |
514 | .IP "[2]" 4 | |
515 | .IX Item "[2]" | |
516 | In \fBextended\fR mode, pressing button 1 with the Control key down | |
517 | starts a toggle operation: the anchor is set to the element under | |
518 | the mouse, and its selection state is reversed. The selection state | |
519 | of other elements isn't changed. | |
520 | If the mouse is dragged with button 1 down, then the selection state | |
521 | of all elements between the anchor and the element under the mouse | |
522 | is set to match that of the anchor element; the selection state of | |
523 | all other elements remains what it was before the toggle operation | |
524 | began. | |
525 | .IP "[3]" 4 | |
526 | .IX Item "[3]" | |
527 | If the mouse leaves the listbox window with button 1 down, the window | |
528 | scrolls away from the mouse, making information visible that used | |
529 | to be off-screen on the side of the mouse. | |
530 | The scrolling continues until the mouse re-enters the window, the | |
531 | button is released, or the end of the listbox is reached. | |
532 | .IP "[4]" 4 | |
533 | .IX Item "[4]" | |
534 | Mouse button 2 may be used for scanning. | |
535 | If it is pressed and dragged over the listbox, the contents of | |
536 | the listbox drag at high speed in the direction the mouse moves. | |
537 | .IP "[5]" 4 | |
538 | .IX Item "[5]" | |
539 | If the Up or Down key is pressed, the location cursor (active | |
540 | element) moves up or down one element. | |
541 | If the selection mode is \fBbrowse\fR or \fBextended\fR then the | |
542 | new active element is also selected and all other elements are | |
543 | deselected. | |
544 | In \fBextended\fR mode the new active element becomes the | |
545 | selection anchor. | |
546 | .IP "[6]" 4 | |
547 | .IX Item "[6]" | |
548 | In \fBextended\fR mode, Shift-Up and Shift-Down move the location | |
549 | cursor (active element) up or down one element and also extend | |
550 | the selection to that element in a fashion similar to dragging | |
551 | with mouse button 1. | |
552 | .IP "[7]" 4 | |
553 | .IX Item "[7]" | |
554 | The Left and Right keys scroll the listbox view left and right | |
555 | by the width of the character \fB0\fR. | |
556 | Control-Left and Control-Right scroll the listbox view left and | |
557 | right by the width of the window. | |
558 | Control-Prior and Control-Next also scroll left and right by | |
559 | the width of the window. | |
560 | .IP "[8]" 4 | |
561 | .IX Item "[8]" | |
562 | The Prior and Next keys scroll the listbox view up and down | |
563 | by one page (the height of the window). | |
564 | .IP "[9]" 4 | |
565 | .IX Item "[9]" | |
566 | The Home and End keys scroll the listbox horizontally to | |
567 | the left and right edges, respectively. | |
568 | .IP "[10]" 4 | |
569 | .IX Item "[10]" | |
570 | Control-Home sets the location cursor to the the first element in | |
571 | the listbox, selects that element, and deselects everything else | |
572 | in the listbox. | |
573 | .IP "[11]" 4 | |
574 | .IX Item "[11]" | |
575 | Control-End sets the location cursor to the the last element in | |
576 | the listbox, selects that element, and deselects everything else | |
577 | in the listbox. | |
578 | .IP "[12]" 4 | |
579 | .IX Item "[12]" | |
580 | In \fBextended\fR mode, Control-Shift-Home extends the selection | |
581 | to the first element in the listbox and Control-Shift-End extends | |
582 | the selection to the last element. | |
583 | .IP "[13]" 4 | |
584 | .IX Item "[13]" | |
585 | In \fBmultiple\fR mode, Control-Shift-Home moves the location cursor | |
586 | to the first element in the listbox and Control-Shift-End moves | |
587 | the location cursor to the last element. | |
588 | .IP "[14]" 4 | |
589 | .IX Item "[14]" | |
590 | The space and Select keys make a selection at the location cursor | |
591 | (active element) just as if mouse button 1 had been pressed over | |
592 | this element. | |
593 | .IP "[15]" 4 | |
594 | .IX Item "[15]" | |
595 | In \fBextended\fR mode, Control-Shift-space and Shift-Select | |
596 | extend the selection to the active element just as if button 1 | |
597 | had been pressed with the Shift key down. | |
598 | .IP "[16]" 4 | |
599 | .IX Item "[16]" | |
600 | In \fBextended\fR mode, the Escape key cancels the most recent | |
601 | selection and restores all the elements in the selected range | |
602 | to their previous selection state. | |
603 | .IP "[17]" 4 | |
604 | .IX Item "[17]" | |
605 | Control-slash selects everything in the widget, except in | |
606 | \&\fBsingle\fR and \fBbrowse\fR modes, in which case it selects | |
607 | the active element and deselects everything else. | |
608 | .IP "[18]" 4 | |
609 | .IX Item "[18]" | |
610 | Control-backslash deselects everything in the widget, except in | |
611 | \&\fBbrowse\fR mode where it has no effect. | |
612 | .IP "[19]" 4 | |
613 | .IX Item "[19]" | |
614 | The F16 key (labelled Copy on many Sun workstations) or Meta-w | |
615 | copies the selection in the widget to the clipboard, if there is | |
616 | a selection. | |
617 | .Sp | |
618 | The behavior of listboxes can be changed by defining new bindings for | |
619 | individual widgets or by redefining the class bindings. | |
620 | .SH "KEYWORDS" | |
621 | .IX Header "KEYWORDS" | |
622 | listbox, widget |