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