OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / man / mann / listbox.n
1 '\"
2 '\" Copyright (c) 1990 The Regents of the University of California.
3 '\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 .TH listbox n 8.4 Tk "Tk Built-In Commands"
9 .\" The -*- nroff -*- definitions below are for supplemental macros used
10 .\" in Tcl/Tk manual entries.
11 .\"
12 .\" .AP type name in/out ?indent?
13 .\"     Start paragraph describing an argument to a library procedure.
14 .\"     type is type of argument (int, etc.), in/out is either "in", "out",
15 .\"     or "in/out" to describe whether procedure reads or modifies arg,
16 .\"     and indent is equivalent to second arg of .IP (shouldn't ever be
17 .\"     needed;  use .AS below instead)
18 .\"
19 .\" .AS ?type? ?name?
20 .\"     Give maximum sizes of arguments for setting tab stops.  Type and
21 .\"     name are examples of largest possible arguments that will be passed
22 .\"     to .AP later.  If args are omitted, default tab stops are used.
23 .\"
24 .\" .BS
25 .\"     Start box enclosure.  From here until next .BE, everything will be
26 .\"     enclosed in one large box.
27 .\"
28 .\" .BE
29 .\"     End of box enclosure.
30 .\"
31 .\" .CS
32 .\"     Begin code excerpt.
33 .\"
34 .\" .CE
35 .\"     End code excerpt.
36 .\"
37 .\" .VS ?version? ?br?
38 .\"     Begin vertical sidebar, for use in marking newly-changed parts
39 .\"     of man pages.  The first argument is ignored and used for recording
40 .\"     the version when the .VS was added, so that the sidebars can be
41 .\"     found and removed when they reach a certain age.  If another argument
42 .\"     is present, then a line break is forced before starting the sidebar.
43 .\"
44 .\" .VE
45 .\"     End of vertical sidebar.
46 .\"
47 .\" .DS
48 .\"     Begin an indented unfilled display.
49 .\"
50 .\" .DE
51 .\"     End of indented unfilled display.
52 .\"
53 .\" .SO ?manpage?
54 .\"     Start of list of standard options for a Tk widget. The manpage
55 .\"     argument defines where to look up the standard options; if
56 .\"     omitted, defaults to "options". The options follow on successive
57 .\"     lines, in three columns separated by tabs.
58 .\"
59 .\" .SE
60 .\"     End of list of standard options for a Tk widget.
61 .\"
62 .\" .OP cmdName dbName dbClass
63 .\"     Start of description of a specific option.  cmdName gives the
64 .\"     option's name as specified in the class command, dbName gives
65 .\"     the option's name in the option database, and dbClass gives
66 .\"     the option's class in the option database.
67 .\"
68 .\" .UL arg1 arg2
69 .\"     Print arg1 underlined, then print arg2 normally.
70 .\"
71 .\" .QW arg1 ?arg2?
72 .\"     Print arg1 in quotes, then arg2 normally (for trailing punctuation).
73 .\"
74 .\" .PQ arg1 ?arg2?
75 .\"     Print an open parenthesis, arg1 in quotes, then arg2 normally
76 .\"     (for trailing punctuation) and then a closing parenthesis.
77 .\"
78 .\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
79 .if t .wh -1.3i ^B
80 .nr ^l \n(.l
81 .ad b
82 .\"     # Start an argument description
83 .de AP
84 .ie !"\\$4"" .TP \\$4
85 .el \{\
86 .   ie !"\\$2"" .TP \\n()Cu
87 .   el          .TP 15
88 .\}
89 .ta \\n()Au \\n()Bu
90 .ie !"\\$3"" \{\
91 \&\\$1 \\fI\\$2\\fP (\\$3)
92 .\".b
93 .\}
94 .el \{\
95 .br
96 .ie !"\\$2"" \{\
97 \&\\$1  \\fI\\$2\\fP
98 .\}
99 .el \{\
100 \&\\fI\\$1\\fP
101 .\}
102 .\}
103 ..
104 .\"     # define tabbing values for .AP
105 .de AS
106 .nr )A 10n
107 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
108 .nr )B \\n()Au+15n
109 .\"
110 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
111 .nr )C \\n()Bu+\\w'(in/out)'u+2n
112 ..
113 .AS Tcl_Interp Tcl_CreateInterp in/out
114 .\"     # BS - start boxed text
115 .\"     # ^y = starting y location
116 .\"     # ^b = 1
117 .de BS
118 .br
119 .mk ^y
120 .nr ^b 1u
121 .if n .nf
122 .if n .ti 0
123 .if n \l'\\n(.lu\(ul'
124 .if n .fi
125 ..
126 .\"     # BE - end boxed text (draw box now)
127 .de BE
128 .nf
129 .ti 0
130 .mk ^t
131 .ie n \l'\\n(^lu\(ul'
132 .el \{\
133 .\"     Draw four-sided box normally, but don't draw top of
134 .\"     box if the box started on an earlier page.
135 .ie !\\n(^b-1 \{\
136 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
137 .\}
138 .el \}\
139 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
140 .\}
141 .\}
142 .fi
143 .br
144 .nr ^b 0
145 ..
146 .\"     # VS - start vertical sidebar
147 .\"     # ^Y = starting y location
148 .\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
149 .de VS
150 .if !"\\$2"" .br
151 .mk ^Y
152 .ie n 'mc \s12\(br\s0
153 .el .nr ^v 1u
154 ..
155 .\"     # VE - end of vertical sidebar
156 .de VE
157 .ie n 'mc
158 .el \{\
159 .ev 2
160 .nf
161 .ti 0
162 .mk ^t
163 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
164 .sp -1
165 .fi
166 .ev
167 .\}
168 .nr ^v 0
169 ..
170 .\"     # Special macro to handle page bottom:  finish off current
171 .\"     # box/sidebar if in box/sidebar mode, then invoked standard
172 .\"     # page bottom macro.
173 .de ^B
174 .ev 2
175 'ti 0
176 'nf
177 .mk ^t
178 .if \\n(^b \{\
179 .\"     Draw three-sided box if this is the box's first page,
180 .\"     draw two sides but no top otherwise.
181 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
182 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
183 .\}
184 .if \\n(^v \{\
185 .nr ^x \\n(^tu+1v-\\n(^Yu
186 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
187 .\}
188 .bp
189 'fi
190 .ev
191 .if \\n(^b \{\
192 .mk ^y
193 .nr ^b 2
194 .\}
195 .if \\n(^v \{\
196 .mk ^Y
197 .\}
198 ..
199 .\"     # DS - begin display
200 .de DS
201 .RS
202 .nf
203 .sp
204 ..
205 .\"     # DE - end display
206 .de DE
207 .fi
208 .RE
209 .sp
210 ..
211 .\"     # SO - start of list of standard options
212 .de SO
213 'ie '\\$1'' .ds So \\fBoptions\\fR
214 'el .ds So \\fB\\$1\\fR
215 .SH "STANDARD OPTIONS"
216 .LP
217 .nf
218 .ta 5.5c 11c
219 .ft B
220 ..
221 .\"     # SE - end of list of standard options
222 .de SE
223 .fi
224 .ft R
225 .LP
226 See the \\*(So manual entry for details on the standard options.
227 ..
228 .\"     # OP - start of full description for a single option
229 .de OP
230 .LP
231 .nf
232 .ta 4c
233 Command-Line Name:      \\fB\\$1\\fR
234 Database Name:  \\fB\\$2\\fR
235 Database Class: \\fB\\$3\\fR
236 .fi
237 .IP
238 ..
239 .\"     # CS - begin code excerpt
240 .de CS
241 .RS
242 .nf
243 .ta .25i .5i .75i 1i
244 ..
245 .\"     # CE - end code excerpt
246 .de CE
247 .fi
248 .RE
249 ..
250 .\"     # UL - underline word
251 .de UL
252 \\$1\l'|0\(ul'\\$2
253 ..
254 .\"     # QW - apply quotation marks to word
255 .de QW
256 .ie '\\*(lq'"' ``\\$1''\\$2
257 .\"" fix emacs highlighting
258 .el \\*(lq\\$1\\*(rq\\$2
259 ..
260 .\"     # PQ - apply parens and quotation marks to word
261 .de PQ
262 .ie '\\*(lq'"' (``\\$1''\\$2)\\$3
263 .\"" fix emacs highlighting
264 .el (\\*(lq\\$1\\*(rq\\$2)\\$3
265 ..
266 .\"     # QR - quoted range
267 .de QR
268 .ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
269 .\"" fix emacs highlighting
270 .el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
271 ..
272 .\"     # MT - "empty" string
273 .de MT
274 .QW ""
275 ..
276 .BS
277 '\" Note:  do not modify the .SH NAME line immediately below!
278 .SH NAME
279 listbox \- Create and manipulate 'listbox' item list widgets
280 .SH SYNOPSIS
281 \fBlistbox\fR \fIpathName \fR?\fIoptions\fR?
282 .SO
283 \-background    \-borderwidth   \-cursor
284 \-disabledforeground    \-exportselection       \-font
285 \-foreground    \-highlightbackground   \-highlightcolor
286 \-highlightthickness    \-relief        \-selectbackground
287 \-selectborderwidth     \-selectforeground      \-setgrid
288 \-takefocus     \-xscrollcommand        \-yscrollcommand
289 .SE
290 .SH "WIDGET-SPECIFIC OPTIONS"
291 .OP \-activestyle activeStyle ActiveStyle
292 Specifies the style in which to draw the active element.  This must be
293 one of \fBdotbox\fR (show a focus ring around the active element),
294 \fBnone\fR (no special indication of active element) or
295 \fBunderline\fR (underline the active element).
296 The default is \fBunderline\fR on Windows, and \fBdotbox\fR elsewhere.
297 .OP \-height height Height
298 Specifies the desired height for the window, in lines.
299 If zero or less, then the desired height for the window is made just
300 large enough to hold all the elements in the listbox.
301 .OP \-listvariable listVariable Variable
302 Specifies the name of a global variable.  The value of the variable is a list to
303 be displayed inside the widget; if the variable value changes then the
304 widget will automatically update itself to reflect the new value.  Attempts
305 to assign a variable with an invalid list value to \fB\-listvariable\fR
306 will cause an error.  Attempts to unset a variable in use as a
307 \fB\-listvariable\fR will fail but will not generate an error.
308 .OP \-selectmode selectMode SelectMode
309 Specifies one of several styles for manipulating the selection.
310 The value of the option may be arbitrary, but the default bindings
311 expect it to be either \fBsingle\fR, \fBbrowse\fR, \fBmultiple\fR,
312 or \fBextended\fR;  the default value is \fBbrowse\fR.
313 .OP \-state state State
314 Specifies one of two states for the listbox:  \fBnormal\fR or \fBdisabled\fR.
315 If the listbox is disabled then items may not be inserted or deleted,
316 items are drawn in the \fB\-disabledforeground\fR color, and selection
317 cannot be modified and is not shown (though selection information is retained).
318 .OP \-width width Width
319 Specifies the desired width for the window in characters.
320 If the font does not have a uniform width then the width of the character
321 .QW 0
322 is used in translating from character units to screen units.
323 If zero or less, then the desired width for the window is made just
324 large enough to hold all the elements in the listbox.
325 .BE
326 .SH DESCRIPTION
327 .PP
328 The \fBlistbox\fR command creates a new window (given by the
329 \fIpathName\fR argument) and makes it into a listbox widget.
330 Additional
331 options, described above, may be specified on the command line
332 or in the option database
333 to configure aspects of the listbox such as its colors, font,
334 text, and relief.  The \fBlistbox\fR command returns its
335 \fIpathName\fR argument.  At the time this command is invoked,
336 there must not exist a window named \fIpathName\fR, but
337 \fIpathName\fR's parent must exist.
338 .PP
339 A listbox is a widget that displays a list of strings, one per line.
340 When first created, a new listbox has no elements.
341 Elements may be added or deleted using widget commands described
342 below.  In addition, one or more elements may be selected as described
343 below.
344 If a listbox is exporting its selection (see \fB\-exportselection\fR
345 option), then it will observe the standard X11 protocols
346 for handling the selection.
347 Listbox selections are available as type \fBSTRING\fR;
348 the value of the selection will be the text of the selected elements, with
349 newlines separating the elements.
350 .PP
351 It is not necessary for all the elements to be
352 displayed in the listbox window at once;  commands described below
353 may be used to change the view in the window.  Listboxes allow
354 scrolling in both directions using the standard \fB\-xscrollcommand\fR
355 and \fB\-yscrollcommand\fR options.
356 They also support scanning, as described below.
357 .SH "INDICES"
358 .PP
359 Many of the widget commands for listboxes take one or more indices
360 as arguments.
361 An index specifies a particular element of the listbox, in any of
362 the following ways:
363 .TP 12
364 \fInumber\fR
365 .
366 Specifies the element as a numerical index, where 0 corresponds
367 to the first element in the listbox.
368 .TP 12
369 \fBactive\fR
370 .
371 Indicates the element that has the location cursor.  This element
372 will be displayed as specified by \fB\-activestyle\fR when the listbox
373 has the keyboard focus, and it is specified with the \fBactivate\fR
374 widget command.
375 .TP 12
376 \fBanchor\fR
377 .
378 Indicates the anchor point for the selection, which is set with the
379 \fBselection anchor\fR widget command.
380 .TP 12
381 \fBend\fR
382 .
383 Indicates the end of the listbox.
384 For most commands this refers to the last element in the listbox,
385 but for a few commands such as \fBindex\fR and \fBinsert\fR
386 it refers to the element just after the last one.
387 .TP 12
388 \fB@\fIx\fB,\fIy\fR
389 Indicates the element that covers the point in the listbox window
390 specified by \fIx\fR and \fIy\fR (in pixel coordinates).  If no
391 element covers that point, then the closest element to that
392 point is used.
393 .LP
394 In the widget command descriptions below, arguments named \fIindex\fR,
395 \fIfirst\fR, and \fIlast\fR always contain text indices in one of
396 the above forms.
397 .SH "WIDGET COMMAND"
398 .PP
399 The \fBlistbox\fR command creates a new Tcl command whose
400 name is \fIpathName\fR.  This
401 command may be used to invoke various
402 operations on the widget.  It has the following general form:
403 .CS
404 \fIpathName option \fR?\fIarg arg ...\fR?
405 .CE
406 \fIOption\fR and the \fIarg\fRs
407 determine the exact behavior of the command.  The following
408 commands are possible for listbox widgets:
409 .TP
410 \fIpathName \fBactivate\fR \fIindex\fR
411 .
412 Sets the active element to the one indicated by \fIindex\fR.
413 If \fIindex\fR is outside the range of elements in the listbox
414 then the closest element is activated.
415 The active element is drawn as specified by \fB\-activestyle\fR when the
416 widget has the input focus, and its index may be retrieved with the
417 index \fBactive\fR.
418 .TP
419 \fIpathName \fBbbox\fR \fIindex\fR
420 .
421 Returns a list of four numbers describing the bounding box of
422 the text in the element given by \fIindex\fR.
423 The first two elements of the list give the x and y coordinates
424 of the upper-left corner of the screen area covered by the text
425 (specified in pixels relative to the widget) and the last two
426 elements give the width and height of the area, in pixels.
427 If no part of the element given by \fIindex\fR is visible on the
428 screen,
429 or if \fIindex\fR refers to a non-existent element,
430 then the result is an empty string;  if the element is
431 partially visible, the result gives the full area of the element,
432 including any parts that are not visible.
433 .TP
434 \fIpathName \fBcget\fR \fIoption\fR
435 .
436 Returns the current value of the configuration option given
437 by \fIoption\fR.
438 \fIOption\fR may have any of the values accepted by the \fBlistbox\fR
439 command.
440 .TP
441 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
442 .
443 Query or modify the configuration options of the widget.
444 If no \fIoption\fR is specified, returns a list describing all of
445 the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
446 information on the format of this list).  If \fIoption\fR is specified
447 with no \fIvalue\fR, then the command returns a list describing the
448 one named option (this list will be identical to the corresponding
449 sublist of the value returned if no \fIoption\fR is specified).  If
450 one or more \fIoption\-value\fR pairs are specified, then the command
451 modifies the given widget option(s) to have the given value(s);  in
452 this case the command returns an empty string.
453 \fIOption\fR may have any of the values accepted by the \fBlistbox\fR
454 command.
455 .TP
456 \fIpathName \fBcurselection\fR
457 .
458 Returns a list containing the numerical indices of
459 all of the elements in the listbox that are currently selected.
460 If there are no elements selected in the listbox then an empty
461 string is returned.
462 .TP
463 \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
464 .
465 Deletes one or more elements of the listbox.  \fIFirst\fR and \fIlast\fR
466 are indices specifying the first and last elements in the range
467 to delete.  If \fIlast\fR is not specified it defaults to
468 \fIfirst\fR, i.e. a single element is deleted.
469 .TP
470 \fIpathName \fBget \fIfirst\fR ?\fIlast\fR?
471 .
472 If \fIlast\fR is omitted, returns the contents of the listbox
473 element indicated by \fIfirst\fR,
474 or an empty string if \fIfirst\fR refers to a non-existent element.
475 If \fIlast\fR is specified, the command returns a list whose elements
476 are all of the listbox elements between \fIfirst\fR and \fIlast\fR,
477 inclusive.
478 Both \fIfirst\fR and \fIlast\fR may have any of the standard
479 forms for indices.
480 .TP
481 \fIpathName \fBindex \fIindex\fR
482 .
483 Returns the integer index value that corresponds to \fIindex\fR.
484 If \fIindex\fR is \fBend\fR the return value is a count of the number
485 of elements in the listbox (not the index of the last element).
486 .TP
487 \fIpathName \fBinsert \fIindex \fR?\fIelement element ...\fR?
488 .
489 Inserts zero or more new elements in the list just before the
490 element given by \fIindex\fR.  If \fIindex\fR is specified as
491 \fBend\fR then the new elements are added to the end of the
492 list.  Returns an empty string.
493 .TP
494 \fIpathName \fBitemcget \fIindex option\fR
495 .
496 Returns the current value of the item configuration option given
497 by \fIoption\fR. \fIOption\fR may have any of the values accepted 
498 by the \fBitemconfigure\fR command.
499 .TP
500 \fIpathName \fBitemconfigure \fIindex\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
501 .
502 Query or modify the configuration options of an item in the listbox.
503 If no \fIoption\fR is specified, returns a list describing all of
504 the available options for the item (see \fBTk_ConfigureInfo\fR for
505 information on the format of this list).  If \fIoption\fR is specified
506 with no \fIvalue\fR, then the command returns a list describing the
507 one named option (this list will be identical to the corresponding
508 sublist of the value returned if no \fIoption\fR is specified).  If
509 one or more \fIoption\-value\fR pairs are specified, then the command
510 modifies the given widget option(s) to have the given value(s);  in
511 this case the command returns an empty string. The following options
512 are currently supported for items:
513 .RS
514 .TP
515 \fB\-background \fIcolor\fR
516 .
517 \fIColor\fR specifies the background color to use when displaying the 
518 item. It may have any of the forms accepted by \fBTk_GetColor\fR.
519 .TP
520 \fB\-foreground \fIcolor\fR
521 .
522 \fIColor\fR specifies the foreground color to use when displaying the
523 item. It may have any of the forms accepted by \fBTk_GetColor\fR.
524 .TP
525 \fB\-selectbackground \fIcolor\fR
526 .
527 \fIcolor\fR specifies the background color to use when displaying the
528 item while it is selected. It may have any of the forms accepted by
529 \fBTk_GetColor\fR.
530 .TP
531 \fB\-selectforeground \fIcolor\fR
532 .
533 \fIcolor\fR specifies the foreground color to use when displaying the
534 item while it is selected. It may have any of the forms accepted by
535 \fBTk_GetColor\fR.
536 .RE
537 .TP
538 \fIpathName \fBnearest \fIy\fR
539 .
540 Given a y-coordinate within the listbox window, this command returns
541 the index of the (visible) listbox element nearest to that y-coordinate.
542 .TP
543 \fIpathName \fBscan\fR \fIoption args\fR
544 .
545 This command is used to implement scanning on listboxes.  It has
546 two forms, depending on \fIoption\fR:
547 .RS
548 .TP
549 \fIpathName \fBscan mark \fIx y\fR
550 .
551 Records \fIx\fR and \fIy\fR and the current view in the listbox
552 window;  used in conjunction with later \fBscan dragto\fR commands.
553 Typically this command is associated with a mouse button press in
554 the widget.  It returns an empty string.
555 .TP
556 \fIpathName \fBscan dragto \fIx y\fR.
557 .
558 This command computes the difference between its \fIx\fR and \fIy\fR
559 arguments and the \fIx\fR and \fIy\fR arguments to the last
560 \fBscan mark\fR command for the widget.
561 It then adjusts the view by 10 times the
562 difference in coordinates.  This command is typically associated
563 with mouse motion events in the widget, to produce the effect of
564 dragging the list at high speed through the window.  The return
565 value is an empty string.
566 .RE
567 .TP
568 \fIpathName \fBsee \fIindex\fR
569 .
570 Adjust the view in the listbox so that the element given by \fIindex\fR
571 is visible.
572 If the element is already visible then the command has no effect;
573 if the element is near one edge of the window then the listbox
574 scrolls to bring the element into view at the edge;  otherwise
575 the listbox scrolls to center the element.
576 .TP
577 \fIpathName \fBselection \fIoption arg\fR
578 .
579 This command is used to adjust the selection within a listbox.  It
580 has several forms, depending on \fIoption\fR:
581 .RS
582 .TP
583 \fIpathName \fBselection anchor \fIindex\fR
584 .
585 Sets the selection anchor to the element given by \fIindex\fR.
586 If \fIindex\fR refers to a non-existent element, then the closest
587 element is used.
588 The selection anchor is the end of the selection that is fixed
589 while dragging out a selection with the mouse.
590 The index \fBanchor\fR may be used to refer to the anchor
591 element.
592 .TP
593 \fIpathName \fBselection clear \fIfirst \fR?\fIlast\fR?
594 .
595 If any of the elements between \fIfirst\fR and \fIlast\fR
596 (inclusive) are selected, they are deselected.
597 The selection state is not changed for elements outside
598 this range.
599 .TP
600 \fIpathName \fBselection includes \fIindex\fR
601 .
602 Returns 1 if the element indicated by \fIindex\fR is currently
603 selected, 0 if it is not.
604 .TP
605 \fIpathName \fBselection set \fIfirst \fR?\fIlast\fR?
606 .
607 Selects all of the elements in the range between
608 \fIfirst\fR and \fIlast\fR, inclusive, without affecting
609 the selection state of elements outside that range.
610 .RE
611 .TP
612 \fIpathName \fBsize\fR
613 .
614 Returns a decimal string indicating the total number of elements
615 in the listbox.
616 .TP
617 \fIpathName \fBxview \fR?\fIargs\fR
618 .
619 This command is used to query and change the horizontal position of the
620 information in the widget's window.  It can take any of the following
621 forms:
622 .RS
623 .TP
624 \fIpathName \fBxview\fR
625 .
626 Returns a list containing two elements.
627 Each element is a real fraction between 0 and 1;  together they describe
628 the horizontal span that is visible in the window.
629 For example, if the first element is .2 and the second element is .6,
630 20% of the listbox's text is off-screen to the left, the middle 40% is visible
631 in the window, and 40% of the text is off-screen to the right.
632 These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
633 option.
634 .TP
635 \fIpathName \fBxview \fIindex\fR
636 .
637 Adjusts the view in the window so that the character position given by
638 \fIindex\fR is displayed at the left edge of the window.
639 Character positions are defined by the width of the character \fB0\fR.
640 .TP
641 \fIpathName \fBxview moveto\fI fraction\fR
642 .
643 Adjusts the view in the window so that \fIfraction\fR of the
644 total width of the listbox text is off-screen to the left.
645 \fIfraction\fR must be a fraction between 0 and 1.
646 .TP
647 \fIpathName \fBxview scroll \fInumber what\fR
648 .
649 This command shifts the view in the window left or right according to
650 \fInumber\fR and \fIwhat\fR.
651 \fINumber\fR must be an integer.
652 \fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
653 of one of these.
654 If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
655 \fInumber\fR character units (the width of the \fB0\fR character)
656 on the display;  if it is \fBpages\fR then the view adjusts by
657 \fInumber\fR screenfuls.
658 If \fInumber\fR is negative then characters farther to the left
659 become visible;  if it is positive then characters farther to the right
660 become visible.
661 .RE
662 .TP
663 \fIpathName \fByview \fR?\fIargs\fR?
664 .
665 This command is used to query and change the vertical position of the
666 text in the widget's window.
667 It can take any of the following forms:
668 .RS
669 .TP
670 \fIpathName \fByview\fR
671 Returns a list containing two elements, both of which are real fractions
672 between 0 and 1.
673 The first element gives the position of the listbox element at the
674 top of the window, relative to the listbox as a whole (0.5 means
675 it is halfway through the listbox, for example).
676 The second element gives the position of the listbox element just after
677 the last one in the window, relative to the listbox as a whole.
678 These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
679 option.
680 .TP
681 \fIpathName \fByview \fIindex\fR
682 .
683 Adjusts the view in the window so that the element given by
684 \fIindex\fR is displayed at the top of the window.
685 .TP
686 \fIpathName \fByview moveto\fI fraction\fR
687 .
688 Adjusts the view in the window so that the element given by \fIfraction\fR
689 appears at the top of the window.
690 \fIFraction\fR is a fraction between 0 and 1;  0 indicates the first
691 element in the listbox, 0.33 indicates the element one-third the
692 way through the listbox, and so on.
693 .TP
694 \fIpathName \fByview scroll \fInumber what\fR
695 .
696 This command adjusts the view in the window up or down according to
697 \fInumber\fR and \fIwhat\fR.
698 \fINumber\fR must be an integer.
699 \fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
700 If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
701 \fInumber\fR lines;  if it is \fBpages\fR then
702 the view adjusts by \fInumber\fR screenfuls.
703 If \fInumber\fR is negative then earlier elements
704 become visible;  if it is positive then later elements
705 become visible.
706 .RE
707 .SH "DEFAULT BINDINGS"
708 .PP
709 Tk automatically creates class bindings for listboxes that give them
710 Motif-like behavior.  Much of the behavior of a listbox is determined
711 by its \fB\-selectmode\fR option, which selects one of four ways
712 of dealing with the selection.
713 .PP
714 If the selection mode is \fBsingle\fR or \fBbrowse\fR, at most one
715 element can be selected in the listbox at once.
716 In both modes, clicking button 1 on an element selects
717 it and deselects any other selected item.
718 In \fBbrowse\fR mode it is also possible to drag the selection
719 with button 1.
720 On button 1, the listbox will also take focus if it has a \fBnormal\fR
721 state and \fB\-takefocus\fR is true.
722 .PP
723 If the selection mode is \fBmultiple\fR or \fBextended\fR,
724 any number of elements may be selected at once, including discontiguous
725 ranges.  In \fBmultiple\fR mode, clicking button 1 on an element
726 toggles its selection state without affecting any other elements.
727 In \fBextended\fR mode, pressing button 1 on an element selects
728 it, deselects everything else, and sets the anchor to the element
729 under the mouse;  dragging the mouse with button 1
730 down extends the selection to include all the elements between
731 the anchor and the element under the mouse, inclusive.
732 .PP
733 Most people will probably want to use \fBbrowse\fR mode for
734 single selections and \fBextended\fR mode for multiple selections;
735 the other modes appear to be useful only in special situations.
736 .PP
737 Any time the selection changes in the listbox, the virtual event
738 \fB<<ListboxSelect>>\fR will be generated.  It is easiest to bind
739 to this event to be made aware of any changes to listbox selection.
740 .PP
741 In addition to the above behavior, the following additional behavior
742 is defined by the default bindings:
743 .IP [1]
744 In \fBextended\fR mode, the selected range can be adjusted by pressing
745 button 1 with the Shift key down:  this modifies the selection to
746 consist of the elements between the anchor and the element under
747 the mouse, inclusive.
748 The un-anchored end of this new selection can also be dragged with
749 the button down.
750 .IP [2]
751 In \fBextended\fR mode, pressing button 1 with the Control key down
752 starts a toggle operation: the anchor is set to the element under
753 the mouse, and its selection state is reversed.  The selection state
754 of other elements is not changed.
755 If the mouse is dragged with button 1 down, then the selection state
756 of all elements between the anchor and the element under the mouse
757 is set to match that of the anchor element;  the selection state of
758 all other elements remains what it was before the toggle operation
759 began.
760 .IP [3]
761 If the mouse leaves the listbox window with button 1 down, the window
762 scrolls away from the mouse, making information visible that used
763 to be off-screen on the side of the mouse.
764 The scrolling continues until the mouse re-enters the window, the
765 button is released, or the end of the listbox is reached.
766 .IP [4]
767 Mouse button 2 may be used for scanning.
768 If it is pressed and dragged over the listbox, the contents of
769 the listbox drag at high speed in the direction the mouse moves.
770 .IP [5]
771 If the Up or Down key is pressed, the location cursor (active
772 element) moves up or down one element.
773 If the selection mode is \fBbrowse\fR or \fBextended\fR then the
774 new active element is also selected and all other elements are
775 deselected.
776 In \fBextended\fR mode the new active element becomes the
777 selection anchor.
778 .IP [6]
779 In \fBextended\fR mode, Shift-Up and Shift-Down move the location
780 cursor (active element) up or down one element and also extend
781 the selection to that element in a fashion similar to dragging
782 with mouse button 1.
783 .IP [7]
784 The Left and Right keys scroll the listbox view left and right
785 by the width of the character \fB0\fR.
786 Control-Left and Control-Right scroll the listbox view left and
787 right by the width of the window.
788 Control-Prior and Control-Next also scroll left and right by
789 the width of the window.
790 .IP [8]
791 The Prior and Next keys scroll the listbox view up and down
792 by one page (the height of the window).
793 .IP [9]
794 The Home and End keys scroll the listbox horizontally to
795 the left and right edges, respectively.
796 .IP [10]
797 Control-Home sets the location cursor to the first element in
798 the listbox, selects that element, and deselects everything else
799 in the listbox.
800 .IP [11]
801 Control-End sets the location cursor to the last element in
802 the listbox, selects that element, and deselects everything else
803 in the listbox.
804 .IP [12]
805 In \fBextended\fR mode, Control-Shift-Home extends the selection
806 to the first element in the listbox and Control-Shift-End extends
807 the selection to the last element.
808 .IP [13]
809 In \fBmultiple\fR mode, Control-Shift-Home moves the location cursor
810 to the first element in the listbox and Control-Shift-End moves
811 the location cursor to the last element.
812 .IP [14]
813 The space and Select keys make a selection at the location cursor
814 (active element) just as if mouse button 1 had been pressed over
815 this element.
816 .IP [15]
817 In \fBextended\fR mode, Control-Shift-space and Shift-Select
818 extend the selection to the active element just as if button 1
819 had been pressed with the Shift key down.
820 .IP [16]
821 In \fBextended\fR mode, the Escape key cancels the most recent
822 selection and restores all the elements in the selected range
823 to their previous selection state.
824 .IP [17]
825 Control-slash selects everything in the widget, except in
826 \fBsingle\fR and \fBbrowse\fR modes, in which case it selects
827 the active element and deselects everything else.
828 .IP [18]
829 Control-backslash deselects everything in the widget, except in
830 \fBbrowse\fR mode where it has no effect.
831 .IP [19]
832 The F16 key (labelled Copy on many Sun workstations) or Meta-w
833 copies the selection in the widget to the clipboard, if there is
834 a selection.
835 .PP
836 The behavior of listboxes can be changed by defining new bindings for
837 individual widgets or by redefining the class bindings.
838 .SH "SEE ALSO"
839 ttk::treeview(n)
840 .SH KEYWORDS
841 listbox, widget
842 '\" Local Variables:
843 '\" mode: nroff
844 '\" End: