Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / mann / scrollbar.n
CommitLineData
920dae64
AT
1'\"
2'\" Copyright (c) 1990-1994 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 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: scrollbar.n,v 1.3.8.1 2004/10/28 12:25:22 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 scrollbar n 4.1 Tk "Tk Built-In Commands"
247.BS
248'\" Note: do not modify the .SH NAME line immediately below!
249.SH NAME
250scrollbar \- Create and manipulate scrollbar widgets
251.SH SYNOPSIS
252\fBscrollbar\fR \fIpathName \fR?\fIoptions\fR?
253.SO
254\-activebackground \-highlightcolor \-repeatdelay
255\-background \-highlightthickness \-repeatinterval
256\-borderwidth \-jump \-takefocus
257\-cursor \-orient \-troughcolor
258\-highlightbackground \-relief
259.SE
260.SH "WIDGET-SPECIFIC OPTIONS"
261.OP \-activerelief activeRelief ActiveRelief
262Specifies the relief to use when displaying the element that is
263active, if any.
264Elements other than the active element are always displayed with
265a raised relief.
266.OP \-command command Command
267Specifies the prefix of a Tcl command to invoke to change the view
268in the widget associated with the scrollbar. When a user requests
269a view change by manipulating the scrollbar, a Tcl command is
270invoked. The actual command consists of this option followed by
271additional information as described later. This option almost always has
272a value such as \fB.t xview\fR or \fB.t yview\fR, consisting of the
273name of a widget and either \fBxview\fR (if the scrollbar is for
274horizontal scrolling) or \fByview\fR (for vertical scrolling).
275All scrollable widgets have \fBxview\fR and \fByview\fR commands
276that take exactly the additional arguments appended by the scrollbar
277as described in SCROLLING COMMANDS below.
278.OP \-elementborderwidth elementBorderWidth BorderWidth
279Specifies the width of borders drawn around the internal elements
280of the scrollbar (the two arrows and the slider). The value may
281have any of the forms acceptable to \fBTk_GetPixels\fR.
282If this value is less than zero, the value of the \fBborderWidth\fR
283option is used in its place.
284.OP \-width width Width
285Specifies the desired narrow dimension of the scrollbar window,
286not including 3-D border, if any. For vertical
287scrollbars this will be the width and for horizontal scrollbars
288this will be the height.
289The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
290.BE
291
292.SH DESCRIPTION
293.PP
294The \fBscrollbar\fR command creates a new window (given by the
295\fIpathName\fR argument) and makes it into a scrollbar widget.
296Additional options, described above, may be specified on the command
297line or in the option database to configure aspects of the scrollbar
298such as its colors, orientation, and relief.
299The \fBscrollbar\fR command returns its \fIpathName\fR argument.
300At the time this command is invoked, there must not exist a window
301named \fIpathName\fR, but \fIpathName\fR's parent must exist.
302.PP
303A scrollbar is a widget that displays two arrows, one at each end of
304the scrollbar, and a \fIslider\fR in the middle portion of the
305scrollbar.
306It provides information about what is visible in an \fIassociated window\fR
307that displays a document of some sort (such as a file being edited or
308a drawing).
309The position and size of the slider indicate which portion of the
310document is visible in the associated window. For example, if the
311slider in a vertical scrollbar covers the top third of the area
312between the two arrows, it means that the associated window displays
313the top third of its document.
314.PP
315Scrollbars can be used to adjust the view in the associated window
316by clicking or dragging with the mouse. See the \fBBINDINGS\fR section
317below for details.
318.SH "ELEMENTS"
319.PP
320A scrollbar displays five elements, which are referred to in the
321widget commands for the scrollbar:
322.TP 10
323\fBarrow1\fR
324The top or left arrow in the scrollbar.
325.TP 10
326\fBtrough1\fR
327The region between the slider and \fBarrow1\fR.
328.TP 10
329\fBslider\fR
330The rectangle that indicates what is visible in the associated widget.
331.TP 10
332\fBtrough2\fR
333The region between the slider and \fBarrow2\fR.
334.TP 10
335\fBarrow2\fR
336The bottom or right arrow in the scrollbar.
337.SH "WIDGET COMMAND"
338.PP
339The \fBscrollbar\fR command creates a new Tcl command whose
340name is \fIpathName\fR. This
341command may be used to invoke various
342operations on the widget. It has the following general form:
343.CS
344\fIpathName option \fR?\fIarg arg ...\fR?
345.CE
346\fIOption\fR and the \fIarg\fRs
347determine the exact behavior of the command. The following
348commands are possible for scrollbar widgets:
349.TP
350\fIpathName \fBactivate \fR?\fIelement\fR?
351Marks the element indicated by \fIelement\fR as active, which
352causes it to be displayed as specified by the \fBactiveBackground\fR
353and \fBactiveRelief\fR options.
354The only element values understood by this command are \fBarrow1\fR,
355\fBslider\fR, or \fBarrow2\fR.
356If any other value is specified then no element of the scrollbar
357will be active.
358If \fIelement\fR is not specified, the command returns
359the name of the element that is currently active, or an empty string
360if no element is active.
361.TP
362\fIpathName \fBcget\fR \fIoption\fR
363Returns the current value of the configuration option given
364by \fIoption\fR.
365\fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
366command.
367.TP
368\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
369Query or modify the configuration options of the widget.
370If no \fIoption\fR is specified, returns a list describing all of
371the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
372information on the format of this list). If \fIoption\fR is specified
373with no \fIvalue\fR, then the command returns a list describing the
374one named option (this list will be identical to the corresponding
375sublist of the value returned if no \fIoption\fR is specified). If
376one or more \fIoption\-value\fR pairs are specified, then the command
377modifies the given widget option(s) to have the given value(s); in
378this case the command returns an empty string.
379\fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
380command.
381.TP
382\fIpathName \fBdelta \fIdeltaX deltaY\fR
383Returns a real number indicating the fractional change in
384the scrollbar setting that corresponds to a given change
385in slider position. For example, if the scrollbar is horizontal,
386the result indicates how much the scrollbar setting must change
387to move the slider \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is
388ignored in this case).
389If the scrollbar is vertical, the result indicates how much the
390scrollbar setting must change to move the slider \fIdeltaY\fR pixels
391down. The arguments and the result may be zero or negative.
392.TP
393\fIpathName \fBfraction \fIx y\fR
394Returns a real number between 0 and 1 indicating where the point
395given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar.
396The value 0 corresponds to the top or left of the trough, the
397value 1 corresponds to the bottom or right, 0.5 corresponds to
398the middle, and so on.
399\fIX\fR and \fIy\fR must be pixel coordinates relative to the scrollbar
400widget.
401If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest
402point in the trough is used.
403.TP
404\fIpathName \fBget\fR
405Returns the scrollbar settings in the form of a list whose
406elements are the arguments to the most recent \fBset\fR widget command.
407.TP
408\fIpathName \fBidentify\fR \fIx y\fR
409Returns the name of the element under the point given by \fIx\fR and
410\fIy\fR (such as \fBarrow1\fR), or an empty string if the point does
411not lie in any element of the scrollbar.
412\fIX\fR and \fIy\fR must be pixel coordinates relative to the scrollbar
413widget.
414.TP
415\fIpathName \fBset\fR \fIfirst last\fR
416This command is invoked by the scrollbar's associated widget to
417tell the scrollbar about the current view in the widget.
418The command takes two arguments, each of which is a real fraction
419between 0 and 1.
420The fractions describe the range of the document that is visible in
421the associated widget.
422For example, if \fIfirst\fR is 0.2 and \fIlast\fR is 0.4, it means
423that the first part of the document visible in the window is 20%
424of the way through the document, and the last visible part is 40%
425of the way through.
426.SH "SCROLLING COMMANDS"
427.PP
428When the user interacts with the scrollbar, for example by dragging
429the slider, the scrollbar notifies the associated widget that it
430must change its view.
431The scrollbar makes the notification by evaluating a Tcl command
432generated from the scrollbar's \fB\-command\fR option.
433The command may take any of the following forms.
434In each case, \fIprefix\fR is the contents of the
435\fB\-command\fR option, which usually has a form like \fB.t yview\fR
436.TP
437\fIprefix \fBmoveto \fIfraction\fR
438\fIFraction\fR is a real number between 0 and 1.
439The widget should adjust its view so that the point given
440by \fIfraction\fR appears at the beginning of the widget.
441If \fIfraction\fR is 0 it refers to the beginning of the
442document. 1.0 refers to the end of the document, 0.333
443refers to a point one-third of the way through the document,
444and so on.
445.TP
446\fIprefix \fBscroll \fInumber \fBunits\fR
447The widget should adjust its view by \fInumber\fR units.
448The units are defined in whatever way makes sense for the widget,
449such as characters or lines in a text widget.
450\fINumber\fR is either 1, which means one unit should scroll off
451the top or left of the window, or \-1, which means that one unit
452should scroll off the bottom or right of the window.
453.TP
454\fIprefix \fBscroll \fInumber \fBpages\fR
455The widget should adjust its view by \fInumber\fR pages.
456It is up to the widget to define the meaning of a page; typically
457it is slightly less than what fits in the window, so that there
458is a slight overlap between the old and new views.
459\fINumber\fR is either 1, which means the next page should
460become visible, or \-1, which means that the previous page should
461become visible.
462.SH "OLD COMMAND SYNTAX"
463.PP
464In versions of Tk before 4.0, the \fBset\fR and \fBget\fR widget
465commands used a different form.
466This form is still supported for backward compatibility, but it
467is deprecated.
468In the old command syntax, the \fBset\fR widget command has the
469following form:
470.TP
471\fIpathName \fBset\fR \fItotalUnits windowUnits firstUnit lastUnit\fR
472In this form the arguments are all integers.
473\fITotalUnits\fR gives the total size of the object being displayed in the
474associated widget. The meaning of one unit depends on the associated
475widget; for example, in a text editor widget units might
476correspond to lines of
477text. \fIWindowUnits\fR indicates the total number of units that
478can fit in the associated window at one time. \fIFirstUnit\fR
479and \fIlastUnit\fR give the indices of the first and last units
480currently visible in the associated window (zero corresponds to the
481first unit of the object).
482.LP
483Under the old syntax the \fBget\fR widget command returns a list
484of four integers, consisting of the \fItotalUnits\fR, \fIwindowUnits\fR,
485\fIfirstUnit\fR, and \fIlastUnit\fR values from the last \fBset\fR
486widget command.
487.PP
488The commands generated by scrollbars also have a different form
489when the old syntax is being used:
490.TP
491\fIprefix\fR \fIunit\fR
492\fIUnit\fR is an integer that indicates what should appear at
493the top or left of the associated widget's window.
494It has the same meaning as the \fIfirstUnit\fR and \fIlastUnit\fR
495arguments to the \fBset\fR widget command.
496.LP
497The most recent \fBset\fR widget command determines whether or not
498to use the old syntax.
499If it is given two real arguments then the new syntax will be
500used in the future, and if it is given four integer arguments then
501the old syntax will be used.
502.SH BINDINGS
503Tk automatically creates class bindings for scrollbars that give them
504the following default behavior.
505If the behavior is different for vertical and horizontal scrollbars,
506the horizontal behavior is described in parentheses.
507.IP [1]
508Pressing button 1 over \fBarrow1\fR causes the view in the
509associated widget to shift up (left) by one unit so that the
510document appears to move down (right) one unit.
511If the button is held down, the action auto-repeats.
512.IP [2]
513Pressing button 1 over \fBtrough1\fR causes the view in the
514associated widget to shift up (left) by one screenful so that the
515document appears to move down (right) one screenful.
516If the button is held down, the action auto-repeats.
517.IP [3]
518Pressing button 1 over the slider and dragging causes the view
519to drag with the slider.
520If the \fBjump\fR option is true, then the view doesn't drag along
521with the slider; it changes only when the mouse button is released.
522.IP [4]
523Pressing button 1 over \fBtrough2\fR causes the view in the
524associated widget to shift down (right) by one screenful so that the
525document appears to move up (left) one screenful.
526If the button is held down, the action auto-repeats.
527.IP [5]
528Pressing button 1 over \fBarrow2\fR causes the view in the
529associated widget to shift down (right) by one unit so that the
530document appears to move up (left) one unit.
531If the button is held down, the action auto-repeats.
532.IP [6]
533If button 2 is pressed over the trough or the slider, it sets
534the view to correspond to the mouse position; dragging the
535mouse with button 2 down causes the view to drag with the mouse.
536If button 2 is pressed over one of the arrows, it causes the
537same behavior as pressing button 1.
538.IP [7]
539If button 1 is pressed with the Control key down, then if the
540mouse is over \fBarrow1\fR or \fBtrough1\fR the view changes
541to the very top (left) of the document; if the mouse is over
542\fBarrow2\fR or \fBtrough2\fR the view changes
543to the very bottom (right) of the document; if the mouse is
544anywhere else then the button press has no effect.
545.IP [8]
546In vertical scrollbars the Up and Down keys have the same behavior
547as mouse clicks over \fBarrow1\fR and \fBarrow2\fR, respectively.
548In horizontal scrollbars these keys have no effect.
549.IP [9]
550In vertical scrollbars Control-Up and Control-Down have the same
551behavior as mouse clicks over \fBtrough1\fR and \fBtrough2\fR, respectively.
552In horizontal scrollbars these keys have no effect.
553.IP [10]
554In horizontal scrollbars the Up and Down keys have the same behavior
555as mouse clicks over \fBarrow1\fR and \fBarrow2\fR, respectively.
556In vertical scrollbars these keys have no effect.
557.IP [11]
558In horizontal scrollbars Control-Up and Control-Down have the same
559behavior as mouse clicks over \fBtrough1\fR and \fBtrough2\fR, respectively.
560In vertical scrollbars these keys have no effect.
561.IP [12]
562The Prior and Next keys have the same behavior
563as mouse clicks over \fBtrough1\fR and \fBtrough2\fR, respectively.
564.IP [13]
565The Home key adjusts the view to the top (left edge) of the document.
566.IP [14]
567The End key adjusts the view to the bottom (right edge) of the document.
568.SH EXAMPLE
569Create a window with a scrollable \fBtext\fR widget:
570.CS
571toplevel .tl
572text .tl.t -yscrollcommand {.tl.s set}
573\fBscrollbar\fR .tl.s -command {.tl.t yview}
574grid .tl.t .tl.s -sticky nsew
575grid columnconfigure .tl 0 -weight 1
576grid rowconfigure .tl 0 -weight 1
577.CE
578
579.SH KEYWORDS
580scrollbar, widget