Debian Codegraph @

info/gcl-tk/scrollbar.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>scrollbar (GCL TK Manual)</title>
7
8 <meta name="description" content="scrollbar (GCL TK Manual)">
9 <meta name="keywords" content="scrollbar (GCL TK Manual)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
15 <link href="Widgets.html" rel="up" title="Widgets">
16 <link href="checkbutton.html" rel="next" title="checkbutton">
17 <link href="menu.html" rel="prev" title="menu">
18 <style type="text/css">
19 <!--
20 a.summary-letter {text-decoration: none}
21 blockquote.indentedblock {margin-right: 0em}
22 div.display {margin-left: 3.2em}
23 div.example {margin-left: 3.2em}
24 div.lisp {margin-left: 3.2em}
25 kbd {font-style: oblique}
26 pre.display {font-family: inherit}
27 pre.format {font-family: inherit}
28 pre.menu-comment {font-family: serif}
29 pre.menu-preformatted {font-family: serif}
30 span.nolinebreak {white-space: nowrap}
31 span.roman {font-family: initial; font-weight: normal}
32 span.sansserif {font-family: sans-serif; font-weight: normal}
33 ul.no-bullet {list-style: none}
34 -->
35 </style>
36
37
38 </head>
39
40 <body lang="en">
41 <span id="scrollbar"></span><div class="header">
42 <p>
43 Next: <a href="checkbutton.html" accesskey="n" rel="next">checkbutton</a>, Previous: <a href="menu.html" accesskey="p" rel="prev">menu</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
44 </div>
45 <hr>
46 <span id="scrollbar-1"></span><h3 class="section">2.6 scrollbar</h3>
47
48 <p>scrollbar \- Create and manipulate scrollbar widgets
49 </p><span id="Synopsis-5"></span><h4 class="unnumberedsubsec">Synopsis</h4>
50 <p><b>scrollbar</b><i> pathName </i><span class="roman">?</span><i>options</i>?
51 </p><span id="Standard-Options-5"></span><h4 class="unnumberedsubsec">Standard Options</h4>
52
53
54 <div class="example">
55 <pre class="example">activeForeground cursor relief
56 background foreground repeatDelay
57 borderWidth orient repeatInterval
58 </pre></div>
59
60
61 <p>See <a href="options.html">options</a>, for more information.
62 </p><span id="Arguments-for-Scrollbar"></span><h4 class="unnumberedsubsec">Arguments for Scrollbar</h4>
63
64
65 <dl compact="compact">
66 <dt><code><b>:command</b></code></dt>
67 <dd><p align="right">Name=<code>&quot;<b>command</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Command</b>&quot;</code>
68 </p><br>
69
70 <p>Specifies the prefix of a Tcl command to invoke to change the view
71 in the widget associated with the scrollbar. When a user requests
72 a view change by manipulating the scrollbar, a Tcl command is
73 invoked. The actual command consists of this option followed by
74 a space and a number. The number indicates the logical unit that
75 should appear at the top of the associated window.
76 </p></dd>
77 </dl>
78
79
80 <dl compact="compact">
81 <dt><code><b>:width</b></code></dt>
82 <dd><p align="right">Name=<code>&quot;<b>width</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Width</b>&quot;</code>
83 </p><br>
84
85 <p>Specifies the desired narrow dimension of the scrollbar window,
86 not including 3-D border, if any. For vertical
87 scrollbars this will be the width and for horizontal scrollbars
88 this will be the height.
89 The value may have any of the forms acceptable to <b>Tk_GetPixels</b>.
90 </p></dd>
91 </dl>
92
93 <span id="Description-3"></span><h4 class="unnumberedsubsec">Description</h4>
94
95 <p>The <b>scrollbar</b> command creates a new window (given by the
96 <i>pathName</i> argument) and makes it into a scrollbar widget.
97 Additional
98 options, described above, may be specified on the command line
99 or in the option database
100 to configure aspects of the scrollbar such as its colors, orientation,
101 and relief. The <b>scrollbar</b> command returns its
102 <i>pathName</i> argument. At the time this command is invoked,
103 there must not exist a window named <i>pathName</i>, but
104 <i>pathName</i>&rsquo;s parent must exist.
105 </p>
106 <p>A scrollbar is a widget that displays two arrows, one at each end of
107 the scrollbar, and a <i>slider</i> in the middle portion of the
108 scrollbar. A scrollbar is used to provide information about what
109 is visible in an <i>associated window</i> that displays an object
110 of some sort (such as a file being edited or a drawing).
111 The position and size of the slider indicate which portion of the
112 object is visible in the associated window. For example, if the
113 slider in a vertical scrollbar covers the top third of the area
114 between the two arrows, it means that the associated window displays
115 the top third of its object.
116 </p>
117 <p>Scrollbars can be used to adjust the view in the associated window
118 by clicking or dragging with the mouse. See the BINDINGS section
119 below for details.
120 </p>
121 <span id="A-Scrollbar-Widget_0027s-Arguments"></span><h4 class="unnumberedsubsec">A Scrollbar Widget&rsquo;s Arguments</h4>
122
123 <p>The <b>scrollbar</b> command creates a new Tcl command whose
124 name is <i>pathName</i>. This
125 command may be used to invoke various
126 operations on the widget. It has the following general form:
127 </p>
128 <div class="example">
129 <pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
130 </pre></div>
131
132 <p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
133 determine the exact behavior of the command. The following
134 commands are possible for scrollbar widgets:
135 </p>
136 <dl compact="compact">
137 <dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt>
138 <dd><p>Query or modify the configuration options of the widget.
139 If no <i>option</i> is specified, returns a list describing all of
140 the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
141 information on the format of this list). If <i>option</i> is specified
142 with no <i>value</i>, then the command returns a list describing the
143 one named option (this list will be identical to the corresponding
144 sublist of the value returned if no <i>option</i> is specified). If
145 one or more <i>option:value</i> pairs are specified, then the command
146 modifies the given widget option(s) to have the given value(s); in
147 this case the command returns an empty string.
148 <i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>scrollbar</b>
149 command.
150 </p></dd>
151 <dt><i>pathName </i><b>:get</b></dt>
152 <dd><p>Returns a Tcl list containing four decimal values, which are
153 the current <i>totalUnits</i><span class="roman">, </span><i>widnowUnits</i><span class="roman">, </span><i>firstUnit</i>,
154 and <i>lastUnit</i> values for the scrollbar. These are the values
155 from the most recent <b>set</b> widget command on the scrollbar.
156 </p></dd>
157 <dt><i>pathName </i><b>:set</b><span class="roman"> </span><i>totalUnits windowUnits firstUnit lastUnit</i></dt>
158 <dd><p>This command is invoked to give the scrollbar information about the
159 widget associated with the scrollbar. <i>TotalUnits</i> is an integer
160 value giving the total size of the object being displayed in the
161 associated widget. The meaning of one unit depends on the associated
162 widget; for example, in a text editor widget units might
163 correspond to lines of
164 text. <i>WindowUnits</i> indicates the total number of units that
165 can fit in the associated window at one time. <i>FirstUnit</i>
166 and <i>lastUnit</i> give the indices of the first and last units
167 currently visible in the associated window (zero corresponds to the
168 first unit of the object). This command should
169 be invoked by the associated widget whenever its object or window
170 changes size and whenever it changes the view in its window.
171 </p>
172 </dd>
173 </dl>
174 <span id="Bindings-2"></span><h4 class="unnumberedsubsec">Bindings</h4>
175
176 <p>The description below assumes a vertically-oriented scrollbar.
177 For a horizontally-oriented scrollbar replace the words &ldquo;up&rdquo;, &ldquo;down&rdquo;,
178 &ldquo;top&rdquo;, and &ldquo;bottom&rdquo; with &ldquo;left&rdquo;, &ldquo;right&rdquo;, &ldquo;left&rdquo;,
179 and &ldquo;right&rdquo;, respectively
180 </p>
181 <p>A scrollbar widget is divided into five distinct areas. From top
182 to bottom, they are: the top arrow, the top gap (the empty space
183 between the arrow and the slider), the slider, the bottom gap,
184 and the bottom arrow. Pressing mouse button 1 in each area has
185 a different effect:
186 </p>
187 <dl compact="compact">
188 <dt><b>top arrow</b></dt>
189 <dd><p>Causes the view in the associated window to shift up by one unit
190 (i.e. the object appears to move down one unit in its window).
191 If the button is held down the action will auto-repeat.
192 </p></dd>
193 <dt><b>top gap</b></dt>
194 <dd><p>Causes the view in the associated window to shift up by one
195 less than the number of units in the window
196 (i.e. the portion of the object that used to appear at the very
197 top of the window will now appear at the very bottom).
198 If the button is held down the action will auto-repeat.
199 </p></dd>
200 <dt><b>slider</b></dt>
201 <dd><p>Pressing button 1 in this area has no immediate effect except to
202 cause the slider to appear sunken rather than raised. However,
203 if the mouse is moved with the button down then the slider will
204 be dragged, adjusting the view as the mouse is moved.
205 </p></dd>
206 <dt><b>bottom gap</b></dt>
207 <dd><p>Causes the view in the associated window to shift down by one
208 less than the number of units in the window
209 (i.e. the portion of the object that used to appear at the very
210 bottom of the window will now appear at the very top).
211 If the button is held down the action will auto-repeat.
212 </p></dd>
213 <dt><b>bottom arrow</b></dt>
214 <dd><p>Causes the view in the associated window to shift down by one unit
215 (i.e. the object appears to move up one unit in its window).
216 If the button is held down the action will auto-repeat.
217 </p>
218 <p>Note: none of the actions described above has an immediate impact
219 on the position of the slider in the scrollbar. It simply invokes
220 the command specified in the <b>command</b> option to notify the
221 associated widget that a change in view is desired. If the view is
222 actually changed then the associated widget must invoke the
223 scrollbar&rsquo;s <b>set</b> widget command to change what is displayed in
224 the scrollbar.
225 </p>
226 </dd>
227 </dl>
228 <span id="Keywords-5"></span><h4 class="unnumberedsubsec">Keywords</h4>
229 <p>scrollbar, widget
230 </p><hr>
231 <div class="header">
232 <p>
233 Next: <a href="checkbutton.html" accesskey="n" rel="next">checkbutton</a>, Previous: <a href="menu.html" accesskey="p" rel="prev">menu</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
234 </div>
235
236
237
238 </body>
239 </html>