]> www.wagner.pp.ru Git - oss/ck.git/blob - doc/scrollbar.n
Ck console graphics toolkit
[oss/ck.git] / doc / scrollbar.n
1 '\"
2 '\" Copyright (c) 1990-1994 The Regents of the University of California.
3 '\" Copyright (c) 1994-1995 Sun Microsystems, Inc.
4 '\" Copyright (c) 1996-1999 Christian Werner
5 '\"
6 '\" See the file "license.terms" for information on usage and redistribution
7 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 '\" 
9 .so man.macros
10 .TH scrollbar n 8.0 Ck "Ck Built-In Commands"
11 .BS
12 '\" Note:  do not modify the .SH NAME line immediately below!
13 .SH NAME
14 scrollbar \- Create and manipulate scrollbar widgets
15 .SH SYNOPSIS
16 \fBscrollbar\fI pathName \fR?\fIoptions\fR?
17 .SH "STANDARD OPTIONS"
18 .LP
19 .nf
20 .ta 4c 8c 12c
21 \fBactiveAttributes\fR  \fBactiveForeground\fR  \fBbackground\fR        \fBorient\fR
22 \fBactiveBackground\fR  \fBattributes\fR        \fBforeground\fR        \fBtakeFocus\fR
23 .fi
24 .LP
25 See the ``options'' manual entry for details on the standard options.
26 .SH "WIDGET-SPECIFIC OPTIONS"
27 .ta 4c
28 .LP
29 .nf
30 Name:   \fBcommand\fR
31 Class:  \fBCommand\fR
32 Command-Line Switch:    \fB\-command\fR
33 .fi
34 .IP
35 Specifies the prefix of a Tcl command to invoke to change the view
36 in the widget associated with the scrollbar.  When a user requests
37 a view change by manipulating the scrollbar, a Tcl command is
38 invoked.  The actual command consists of this option followed by
39 additional information as described later.
40 .BE
41
42 .SH DESCRIPTION
43 .PP
44 The \fBscrollbar\fR command creates a new window (given by the
45 \fIpathName\fR argument) and makes it into a scrollbar widget.
46 Additional options, described above, may be specified on the command
47 line or in the option database to configure aspects of the scrollbar
48 such as its colors, orientation, and relief.
49 The \fBscrollbar\fR command returns its \fIpathName\fR argument.
50 At the time this command is invoked, there must not exist a window
51 named \fIpathName\fR, but \fIpathName\fR's parent must exist.
52 .PP
53 A scrollbar is a widget that displays two arrows, one at each end of
54 the scrollbar, and a \fIslider\fR in the middle portion of the
55 scrollbar.
56 It provides information about what is visible in an \fIassociated window\fR
57 that displays an document of some sort (such as a file being edited).
58 The position and size of the slider indicate which portion of the
59 document is visible in the associated window.  For example, if the
60 slider in a vertical scrollbar covers the top third of the area
61 between the two arrows, it means that the associated window displays
62 the top third of its document.
63 .PP
64 Scrollbars can be used to adjust the view in the associated window
65 by clicking or dragging with the mouse.  See the BINDINGS section
66 below for details.
67
68 .SH "ELEMENTS"
69 A scrollbar displays five elements, which are referred to in the
70 widget commands for the scrollbar:
71 .TP 10
72 \fBarrow1\fR
73 The top or left arrow in the scrollbar.
74 .TP 10
75 \fBtrough1\fR
76 The region between the slider and \fBarrow1\fR.
77 .TP 10
78 \fBslider\fR
79 The rectangle that indicates what is visible in the associated widget.
80 .TP 10
81 \fBtrough2\fR
82 The region between the slider and \fBarrow2\fR.
83 .TP 10
84 \fBarrow2\fR
85 The bottom or right arrow in the scrollbar.
86
87 .SH "WIDGET COMMAND"
88 .PP
89 The \fBscrollbar\fR command creates a new Tcl command whose
90 name is \fIpathName\fR.  This
91 command may be used to invoke various
92 operations on the widget.  It has the following general form:
93 .DS C
94 \fIpathName option \fR?\fIarg arg ...\fR?
95 .DE
96 \fIOption\fR and the \fIarg\fRs
97 determine the exact behavior of the command.  The following
98 commands are possible for scrollbar widgets:
99 .TP
100 \fIpathName \fBactivate\fR
101 Marks the scrollbar as active, which
102 causes it to be displayed as specified by the
103 \fBactiveAttributes\fR, \fBactiveBackground\fR and \fBactiveForeground\fR
104 options.
105 .TP
106 \fIpathName \fBcget\fR \fIoption\fR
107 Returns the current value of the configuration option given
108 by \fIoption\fR.
109 \fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
110 command.
111 .TP
112 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
113 Query or modify the configuration options of the widget.
114 If no \fIoption\fR is specified, returns a list describing all of
115 the available options for \fIpathName\fR. If \fIoption\fR is specified
116 with no \fIvalue\fR, then the command returns a list describing the
117 one named option (this list will be identical to the corresponding
118 sublist of the value returned if no \fIoption\fR is specified).  If
119 one or more \fIoption\-value\fR pairs are specified, then the command
120 modifies the given widget option(s) to have the given value(s);  in
121 this case the command returns an empty string.
122 \fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
123 command.
124 .TP
125 \fIpathName \fBdeactivate\fR
126 Marks the scrollbar as normal, which
127 causes it to be displayed as specified by the
128 \fBattributes\fR, \fBbackground\fR and \fBforeground\fR options.
129 .TP
130 \fIpathName \fBfraction \fIx y\fR
131 Returns a real number between 0 and 1 indicating where the point
132 given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar.
133 The value 0 corresponds to the top or left of the trough, the
134 value 1 corresponds to the bottom or right, 0.5 corresponds to
135 the middle, and so on.
136 \fIX\fR and \fIy\fR must be screen coordinates relative to the scrollbar
137 widget.
138 If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest
139 point in the trough is used.
140 .TP
141 \fIpathName \fBget\fR
142 Returns the scrollbar settings in the form of a list whose
143 elements are the arguments to the most recent \fBset\fR widget command.
144 .TP
145 \fIpathName \fBidentify\fR \fIx y\fR
146 Returns the name of the element under the point given by \fIx\fR and
147 \fIy\fR (such as \fBarrow1\fR), or an empty string if the point does
148 not lie in any element of the scrollbar.
149 \fIX\fR and \fIy\fR must be screen coordinates relative to the scrollbar
150 widget.
151 .TP
152 \fIpathName \fBset\fR \fIfirst last\fR
153 This command is invoked by the scrollbar's associated widget to
154 tell the scrollbar about the current view in the widget.
155 The command takes two arguments, each of which is a real fraction
156 between 0 and 1.
157 The fractions describe the range of the document that is visible in
158 the associated widget.
159 For example, if \fIfirst\fR is 0.2 and \fIlast\fR is 0.4, it means
160 that the first part of the document visible in the window is 20%
161 of the way through the document, and the last visible part is 40%
162 of the way through.
163
164 .SH "SCROLLING COMMANDS"
165 .PP
166 When the user interacts with the scrollbar, for example by dragging
167 the slider, the scrollbar notifies the associated widget that it
168 must change its view.
169 The scrollbar makes the notification by evaluating a Tcl command
170 generated from the scrollbar's \fB\-command\fR option.
171 The command may take any of the following forms.
172 In each case, \fIprefix\fR is the contents of the
173 \fB\-command\fR option, which usually has a form like \fB.t yview\fR
174 .TP
175 \fIprefix \fBmoveto \fIfraction\fR
176 \fIFraction\fR is a real number between 0 and 1.
177 The widget should adjust its view so that the point given
178 by \fIfraction\fR appears at the beginning of the widget.
179 If \fIfraction\fR is 0 it refers to the beginning of the
180 document.  1.0 refers to the end of the document, 0.333
181 refers to a point one-third of the way through the document,
182 and so on.
183 .TP
184 \fIprefix \fBscroll \fInumber \fBunit\fR
185 The widget should adjust its view by \fInumber\fR units.
186 The units are defined in whatever way makes sense for the widget,
187 such as characters or lines in a text widget.
188 \fINumber\fR is either 1, which means one unit should scroll off
189 the top or left of the window, or \-1, which means that one unit
190 should scroll off the bottom or right of the window.
191 .TP
192 \fIprefix \fBscroll \fInumber \fBpage\fR
193 The widget should adjust its view by \fInumber\fR pages.
194 It is up to the widget to define the meaning of a page;  typically
195 it is slightly less than what fits in the window, so that there
196 is a slight overlap between the old and new views.
197 \fINumber\fR is either 1, which means the next page should
198 become visible, or \-1, which means that the previous page should
199 become visible.
200
201 .SH BINDINGS
202 Ck automatically creates class bindings for scrollbars that give them
203 the following default behavior.
204 If the behavior is different for vertical and horizontal scrollbars,
205 the horizontal behavior is described in parentheses.
206
207 .IP [1]
208 Pressing button 1 over \fBarrow1\fR causes the view in the
209 associated widget to shift up (left) by one unit so that the
210 document appears to move down (right) one unit.
211 .IP [2]
212 Pressing button 1 over \fBtrough1\fR causes the view in the
213 associated widget to shift up (left) by one screenful so that the
214 document appears to move down (right) one screenful.
215 .IP [3]
216 Pressing button 1 over \fBtrough2\fR causes the view in the
217 associated widget to shift down (right) by one screenful so that the
218 document appears to move up (left) one screenful.
219 .IP [4]
220 Pressing button 1 over \fBarrow2\fR causes the view in the
221 associated widget to shift down (right) by one unit so that the
222 document appears to move up (left) one unit.
223 .IP [5]
224 In vertical scrollbars the Up and Down keys have the same behavior
225 as mouse clicks over \fBarrow1\fR and \fBarrow2\fR, respectively.
226 In horizontal scrollbars these keys have no effect.
227 .IP [6]
228 In horizontal scrollbars the Left and Right keys have the same behavior
229 as mouse clicks over \fBarrow1\fR and \fBarrow2\fR, respectively.
230 In vertical scrollbars these keys have no effect.
231 .IP [7]
232 The Prior and Next keys have the same behavior
233 as mouse clicks over \fBtrough1\fR and \fBtrough2\fR, respectively.
234 .IP [8]
235 The Home key adjusts the view to the top (left edge) of the document.
236 .IP [9]
237 The End key adjusts the view to the bottom (right edge) of the document.
238 .IP [10]
239 FocusIn and FocusOut events activate and deactive the scrollbars, respectively.
240
241 .SH KEYWORDS
242 scrollbar, widget