/usr/lib/perl5/Tk/Scale.pod is in perl-tk 1:804.031-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | # Copyright (c) 1990-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#
=head1 NAME
Tk::Scale - Create and manipulate Scale widgets
=for category Tk Widget Classes
=head1 SYNOPSIS
I<$scale> = I<$parent>-E<gt>B<Scale>(?I<options>?);
=head1 STANDARD OPTIONS
B<-activebackground> B<-font> B<-highlightthickness> B<-repeatinterval>
B<-background> B<-foreground> B<-orient> B<-takefocus>
B<-borderwidth> B<-highlightbackground> B<-relief> B<-troughcolor>
B<-cursor> B<-highlightcolor> B<-repeatdelay>
See L<Tk::options> for details of the standard options.
=head1 WIDGET-SPECIFIC OPTIONS
=over 4
=item Name: B<bigIncrement>
=item Class: B<BigIncrement>
=item Switch: B<-bigincrement>
Some interactions with the scale cause its value to change by
``large'' increments; this option specifies the size of the
large increments. If specified as 0, the large increments default
to 1/10 the range of the scale.
=item Name: B<command>
=item Class: B<Command>
=item Switch: B<-command>
Specifies the prefix of a L<perl/Tk callback|Tk::callbacks> to invoke whenever the scale's
value is changed via a method.
The actual command consists
of this option followed by a space and a real number indicating the
new value of the scale.
=item Name: B<digits>
=item Class: B<Digits>
=item Switch: B<-digits>
An integer specifying how many significant digits should be retained
when converting the value of the scale to a string.
If the number is less than or equal to zero, then the scale picks
the smallest value that guarantees that every possible slider
position prints as a different string.
=item Name: B<from>
=item Class: B<From>
=item Switch: B<-from>
A real value corresponding to the left or top end of the scale.
=item Name: B<label>
=item Class: B<Label>
=item Switch: B<-label>
A string to display as a label for the scale. For
vertical scales the label is displayed just to the right of the
top end of the scale. For horizontal scales the label is displayed
just above the left end of the scale. If the option is specified
as an empty string, no label is displayed.
=item Name: B<length>
=item Class: B<Length>
=item Switch: B<-length>
Specifies the desired long dimension of the scale in screen units
(i.e. any of the forms acceptable to B<Tk_GetPixels>).
For vertical scales this is the scale's height; for horizontal scales
it is the scale's width.
=item Name: B<resolution>
=item Class: B<Resolution>
=item Switch: B<-resolution>
A real value specifying the resolution for the scale.
If this value is greater than zero then the scale's value will always be
rounded to an even multiple of this value, as will tick marks and
the endpoints of the scale. If the value is less than zero then no
rounding occurs. Defaults to 1 (i.e., the value will be integral).
=item Name: B<showValue>
=item Class: B<ShowValue>
=item Switch: B<-showvalue>
Specifies a boolean value indicating whether or not the current
value of the scale is to be displayed.
=item Name: B<sliderLength>
=item Class: B<SliderLength>
=item Switch: B<-sliderlength>
Specfies the size of the slider, measured in screen units along the slider's
long dimension. The value may be specified in any of the forms acceptable
to B<Tk_GetPixels>.
=item Name: B<sliderRelief>
=item Class: B<SliderRelief>
=item Switch: B<-sliderrelief>
Specifies the relief to use when drawing the slider, such as B<raised>
or B<sunken>.
=item Name: B<state>
=item Class: B<State>
=item Switch: B<-state>
Specifies one of three states for the scale: B<normal>,
B<active>, or B<disabled>.
If the scale is disabled then the value may not be changed and the scale
won't activate.
If the scale is active, the slider is displayed using the color
specified by the B<activeBackground> option.
=item Name: B<tickInterval>
=item Class: B<TickInterval>
=item Switch: B<-tickinterval>
Must be a real value.
Determines the spacing between numerical
tick marks displayed below or to the left of the slider.
If 0, no tick marks will be displayed.
=item Name: B<to>
=item Class: B<To>
=item Switch: B<-to>
Specifies a real value corresponding
to the right or bottom end of the scale.
This value may be either less than or greater than the B<from> option.
=item Name: B<variable>
=item Class: B<Variable>
=item Switch: B<-variable>
Specifies the name of a global variable to link to the scale. Whenever the
value of the variable changes, the scale will update to reflect this
value.
Whenever the scale is manipulated interactively, the variable
will be modified to reflect the scale's new value.
=item Name: B<width>
=item Class: B<Width>
=item Switch: B<-width>
Specifies the desired narrow dimension of the trough in screen units
(i.e. any of the forms acceptable to B<Tk_GetPixels>).
For vertical scales this is the trough's width; for horizontal scales
this is the trough's height.
=back
=head1 DESCRIPTION
The B<Scale> method creates a new window (given by the
$widget argument) and makes it into a scale widget.
Additional
options, described above, may be specified on the command line
or in the option database
to configure aspects of the scale such as its colors, orientation,
and relief. The B<scale> command returns its
$widget argument. At the time this command is invoked,
there must not exist a window named $widget, but
$widget's parent must exist.
A scale is a widget that displays a rectangular I<trough> and a
small I<slider>. The trough corresponds to a range
of real values (determined by the B<from>, B<to>, and
B<resolution> options),
and the position of the slider selects a particular real value.
The slider's position (and hence the scale's value) may be adjusted
with the mouse or keyboard as described in
the L<"BINDINGS"> section below. Whenever the scale's value is changed, a Tcl
command is invoked (using the B<command> option) to notify
other interested widgets of the change.
In addition, the value
of the scale can be linked to a Tcl variable (using the B<variable>
option), so that changes in either are reflected in the other.
Three annotations may be displayed in a scale widget: a label
appearing at the top right of the widget (top left for horizontal
scales), a number displayed just to the left of the slider
(just above the slider for horizontal scales), and a collection
of numerical tick marks just to the left of the current value
(just below the trough for horizontal scales). Each of these three
annotations may be enabled or disabled using the
configuration options.
=head1 WIDGET METHODS
The B<Scale> method creates a widget object.
This object supports the B<configure> and B<cget> methods
described in L<Tk::options> which can be used to enquire and
modify the options described above.
The widget also inherits all the methods provided by the generic
L<Tk::Widget|Tk::Widget> class.
The following additional methods are available for scale widgets:
=over 4
=item I<$scale>-E<gt>B<coords>(?I<value>?)
Returns a list whose elements are the x and y coordinates of
the point along the centerline of the trough that corresponds
to I<value>.
If I<value> is omitted then the scale's current value is used.
=item I<$scale>-E<gt>B<get>(?I<x, y>?)
If I<x> and I<y> are omitted, returns the current value
of the scale. If I<x> and I<y> are specified, they give
pixel coordinates within the widget; the command returns
the scale value corresponding to the given pixel.
Only one of I<x> or I<y> is used: for horizontal scales
I<y> is ignored, and for vertical scales I<x> is ignored.
=item I<$scale>-E<gt>B<identify>(I<x, y>)
Returns a string indicating what part of the scale lies under
the coordinates given by I<x> and I<y>.
A return value of B<slider> means that the point is over
the slider; B<trough1> means that the point is over the
portion of the slider above or to the left of the slider;
and B<trough2> means that the point is over the portion
of the slider below or to the right of the slider.
If the point isn't over one of these elements, an empty string
is returned.
=item I<$scale>-E<gt>B<set>(I<value>)
This command is invoked to change the current value of the scale,
and hence the position at which the slider is displayed. I<Value>
gives the new value for the scale.
The command has no effect if the scale is disabled.
=back
=head1 BINDINGS
Tk automatically creates class bindings for scales that give them
the following default behavior.
Where the behavior is different for vertical and horizontal scales,
the horizontal behavior is described in parentheses.
=over 4
=item [1]
If button 1 is pressed in the trough, the scale's value will
be incremented or decremented by the value of the B<resolution>
option so that the slider moves in the direction of the cursor.
If the button is held down, the action auto-repeats.
=item [2]
If button 1 is pressed over the slider, the slider can be dragged
with the mouse.
=item [3]
If button 1 is pressed in the trough with the Control key down,
the slider moves all the way to the end of its range, in the
direction towards the mouse cursor.
=item [4]
If button 2 is pressed, the scale's value is set to the mouse
position. If the mouse is dragged with button 2 down, the scale's
value changes with the drag.
=item [5]
The Up and Left keys move the slider up (left) by the value
of the B<resolution> option.
=item [6]
The Down and Right keys move the slider down (right) by the value
of the B<resolution> option.
=item [7]
Control-Up and Control-Left move the slider up (left) by the
value of the B<bigIncrement> option.
=item [8]
Control-Down and Control-Right move the slider down (right) by the
value of the B<bigIncrement> option.
=item [9]
Home moves the slider to the top (left) end of its range.
=item [10]
End moves the slider to the bottom (right) end of its range.
If the scale is disabled using the B<state> option then
none of the above bindings have any effect.
The behavior of scales can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
=back
=head1 KEYWORDS
scale, slider, trough, widget
=cut
|