Debian Codegraph @

info/gcl-tk/scale.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>scale (GCL TK Manual)</title>
7
8 <meta name="description" content="scale (GCL TK Manual)">
9 <meta name="keywords" content="scale (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="canvas.html" rel="next" title="canvas">
17 <link href="listbox.html" rel="prev" title="listbox">
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="scale"></span><div class="header">
42 <p>
43 Next: <a href="canvas.html" accesskey="n" rel="next">canvas</a>, Previous: <a href="listbox.html" accesskey="p" rel="prev">listbox</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="scale-1"></span><h3 class="section">2.3 scale</h3>
47
48 <p>scale \- Create and manipulate scale widgets
49 </p><span id="Synopsis-2"></span><h4 class="unnumberedsubsec">Synopsis</h4>
50 <p><b>scale</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>?
51 </p><span id="Standard-Options-2"></span><h4 class="unnumberedsubsec">Standard Options</h4>
52
53
54 <div class="example">
55 <pre class="example">activeForeground borderWidth font orient
56 background cursor foreground relief
57 </pre></div>
58
59
60 <p>See <a href="options.html">options</a>, for more information.
61 </p><span id="Arguments-for-Scale"></span><h4 class="unnumberedsubsec">Arguments for Scale</h4>
62
63
64 <dl compact="compact">
65 <dt><code><b>:command</b></code></dt>
66 <dd><p align="right">Name=<code>&quot;<b>command</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Command</b>&quot;</code>
67 </p><br>
68
69 <p>Specifies the prefix of a Tcl command to invoke whenever the value of
70 the scale is changed interactively. The actual command consists
71 of this option followed by
72 a space and a number. The number indicates the new value of the
73 scale.
74 </p></dd>
75 </dl>
76
77
78 <dl compact="compact">
79 <dt><code><b>:from</b></code></dt>
80 <dd><p align="right">Name=<code>&quot;<b>from</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>From</b>&quot;</code>
81 </p><br>
82
83 <p>Specifies the value corresponding to the left or top end of the
84 scale. Must be an integer.
85 </p></dd>
86 </dl>
87
88
89 <dl compact="compact">
90 <dt><code><b>:label</b></code></dt>
91 <dd><p align="right">Name=<code>&quot;<b>label</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Label</b>&quot;</code>
92 </p><br>
93
94 <p>Specifies a string to displayed as a label for the scale. For
95 vertical scales the label is displayed just to the right of the
96 top end of the scale. For horizontal scales the label is displayed
97 just above the left end of the scale.
98 </p></dd>
99 </dl>
100
101
102 <dl compact="compact">
103 <dt><code><b>:length</b></code></dt>
104 <dd><p align="right">Name=<code>&quot;<b>length</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Length</b>&quot;</code>
105 </p><br>
106
107 <p>Specifies the desired long dimension of the scale in screen units,
108 that is in any of the forms acceptable to <b>Tk_GetPixels</b>.
109 For vertical scales this is the scale&rsquo;s height; for horizontal scales
110 it is the scale&rsquo;s width.
111 </p></dd>
112 </dl>
113
114
115 <dl compact="compact">
116 <dt><code><b>:showvalue</b></code></dt>
117 <dd><p align="right">Name=<code>&quot;<b>showValue</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>ShowValue</b>&quot;</code>
118 </p><br>
119
120 <p>Specifies a boolean value indicating whether or not the current
121 value of the scale is to be displayed.
122 </p></dd>
123 </dl>
124
125
126 <dl compact="compact">
127 <dt><code><b>:sliderforeground</b></code></dt>
128 <dd><p align="right">Name=<code>&quot;<b>sliderForeground</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>sliderForeground</b>&quot;</code>
129 </p><br>
130
131 <p>Specifies the color to use for drawing the slider under normal conditions.
132 When the mouse is in the slider window then the slider&rsquo;s color is
133 determined by the <b>activeForeground</b> option.
134 </p></dd>
135 </dl>
136
137
138 <dl compact="compact">
139 <dt><code><b>:sliderlength</b></code></dt>
140 <dd><p align="right">Name=<code>&quot;<b>sliderLength</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>SliderLength</b>&quot;</code>
141 </p><br>
142
143 <p>Specfies the size of the slider, measured in screen units along the slider&rsquo;s
144 long dimension. The value may be specified in any of the forms acceptable
145 to <b>Tk_GetPixels</b>.
146 </p></dd>
147 </dl>
148
149
150 <dl compact="compact">
151 <dt><code><b>:state</b></code></dt>
152 <dd><p align="right">Name=<code>&quot;<b>state</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>State</b>&quot;</code>
153 </p><br>
154
155 <p>Specifies one of two states for the scale: <b>normal</b><span class="roman"> or </span><b>disabled</b>.
156 If the scale is disabled then the value may not be changed and the scale
157 won&rsquo;t activate when the mouse enters it.
158 </p></dd>
159 </dl>
160
161
162 <dl compact="compact">
163 <dt><code><b>:tickinterval</b></code></dt>
164 <dd><p align="right">Name=<code>&quot;<b>tickInterval</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>TickInterval</b>&quot;</code>
165 </p><br>
166
167 <p>Must be an integer value. Determines the spacing between numerical
168 tick-marks displayed below or to the left of the slider. If specified
169 as 0, then no tick-marks will be displayed.
170 </p></dd>
171 </dl>
172
173
174 <dl compact="compact">
175 <dt><code><b>:to</b></code></dt>
176 <dd><p align="right">Name=<code>&quot;<b>to</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>To</b>&quot;</code>
177 </p><br>
178
179 <p>Specifies the value corresponding to the right or bottom end of the
180 scale. Must be an integer. This value may be either less than or
181 greater than the <b>from</b> option.
182 </p></dd>
183 </dl>
184
185
186 <dl compact="compact">
187 <dt><code><b>:width</b></code></dt>
188 <dd><p align="right">Name=<code>&quot;<b>width</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Width</b>&quot;</code>
189 </p><br>
190
191 <p>Specifies the desired narrow dimension of the scale in screen units
192 (i.e. any of the forms acceptable to <b>Tk_GetPixels</b>).
193 For vertical scales this is the scale&rsquo;s width; for horizontal scales
194 this is the scale&rsquo;s height.
195 </p></dd>
196 </dl>
197
198 <span id="Description-2"></span><h4 class="unnumberedsubsec">Description</h4>
199
200 <p>The <b>scale</b> command creates a new window (given by the
201 <i>pathName</i> argument) and makes it into a scale widget.
202 Additional
203 options, described above, may be specified on the command line
204 or in the option database
205 to configure aspects of the scale such as its colors, orientation,
206 and relief. The <b>scale</b> command returns its
207 <i>pathName</i> argument. At the time this command is invoked,
208 there must not exist a window named <i>pathName</i>, but
209 <i>pathName</i>&rsquo;s parent must exist.
210 </p>
211 <p>A scale is a widget that displays a rectangular region and a
212 small <i>slider</i>. The rectangular region corresponds to a range
213 of integer values (determined by the <b>from</b><span class="roman"> and </span><b>to</b> options),
214 and the position of the slider selects a particular integer value.
215 The slider&rsquo;s position (and hence the scale&rsquo;s value) may be adjusted
216 by clicking or dragging with the mouse as described in the BINDINGS
217 section below. Whenever the scale&rsquo;s value is changed, a Tcl
218 command is invoked (using the <b>command</b> option) to notify
219 other interested widgets of the change.
220 </p>
221 <p>Three annotations may be displayed in a scale widget: a label
222 appearing at the top-left of the widget (top-right for vertical
223 scales), a number displayed just underneath the slider
224 (just to the left of the slider for vertical scales), and a collection
225 of numerical tick-marks just underneath the current value (just to the left of
226 the current value for vertical scales). Each of these three
227 annotations may be selectively enabled or disabled using the
228 configuration options.
229 </p>
230 <span id="A-Scale_0027s_0022Argumentsommand_0022"></span><h4 class="unnumberedsubsec">A Scale&rsquo;s&quot;Argumentsommand&quot;</h4>
231
232 <p>The <b>scale</b> command creates a new Tcl command whose
233 name is <i>pathName</i>. This
234 command may be used to invoke various
235 operations on the widget. It has the following general form:
236 </p>
237 <div class="example">
238 <pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
239 </pre></div>
240
241 <p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
242 determine the exact behavior of the command. The following
243 commands are possible for scale widgets:
244 </p>
245 <dl compact="compact">
246 <dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt>
247 <dd><p>Query or modify the configuration options of the widget.
248 If no <i>option</i> is specified, returns a list describing all of
249 the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
250 information on the format of this list). If <i>option</i> is specified
251 with no <i>value</i>, then the command returns a list describing the
252 one named option (this list will be identical to the corresponding
253 sublist of the value returned if no <i>option</i> is specified). If
254 one or more <i>option:value</i> pairs are specified, then the command
255 modifies the given widget option(s) to have the given value(s); in
256 this case the command returns an empty string.
257 <i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>scale</b>
258 command.
259 </p></dd>
260 <dt><i>pathName </i><b>:get</b></dt>
261 <dd><p>Returns a decimal string giving the current value of the scale.
262 </p></dd>
263 <dt><i>pathName </i><b>:set</b><span class="roman"> </span><i>value</i></dt>
264 <dd><p>This command is invoked to change the current value of the scale,
265 and hence the position at which the slider is displayed. <i>Value</i>
266 gives the new value for the scale.
267 </p>
268 </dd>
269 </dl>
270 <span id="Bindings"></span><h4 class="unnumberedsubsec">Bindings</h4>
271
272 <p>When a new scale is created, it is given the following initial
273 behavior by default:
274 </p>
275 <dl compact="compact">
276 <dt><b>&lt;Enter&gt;</b></dt>
277 <dd><p>Change the slider display to use <b>activeForeground</b> instead of
278 <b>sliderForeground</b>.
279 </p></dd>
280 <dt><b>&lt;Leave&gt;</b></dt>
281 <dd><p>Reset the slider display to use <b>sliderForeground</b> instead of
282 <b>activeForeground</b>.
283 </p></dd>
284 <dt><b>&lt;ButtonPress-1&gt;</b></dt>
285 <dd><p>Change the slider display so that the slider appears sunken rather
286 than raised. Move the slider (and adjust the scale&rsquo;s value)
287 to correspond to the current mouse position.
288 </p></dd>
289 <dt><b>&lt;Button1-Motion&gt;</b></dt>
290 <dd><p>Move the slider (and adjust the scale&rsquo;s value) to correspond to
291 the current mouse position.
292 </p></dd>
293 <dt><b>&lt;ButtonRelease-1&gt;</b></dt>
294 <dd><p>Reset the slider display so that the slider appears raised again.
295 </p>
296 </dd>
297 </dl>
298 <span id="Keywords-2"></span><h4 class="unnumberedsubsec">Keywords</h4>
299 <p>scale, widget
300 </p><hr>
301 <div class="header">
302 <p>
303 Next: <a href="canvas.html" accesskey="n" rel="next">canvas</a>, Previous: <a href="listbox.html" accesskey="p" rel="prev">listbox</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>
304 </div>
305
306
307
308 </body>
309 </html>