| 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: scale.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 |
| 219 | See 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 |
| 226 | Command-Line Name: \\fB\\$1\\fR |
| 227 | Database Name: \\fB\\$2\\fR |
| 228 | Database 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 scale n 4.1 Tk "Tk Built-In Commands" |
| 247 | .BS |
| 248 | '\" Note: do not modify the .SH NAME line immediately below! |
| 249 | .SH NAME |
| 250 | scale \- Create and manipulate scale widgets |
| 251 | .SH SYNOPSIS |
| 252 | \fBscale\fR \fIpathName \fR?\fIoptions\fR? |
| 253 | .SO |
| 254 | \-activebackground \-foreground \-relief |
| 255 | \-background \-highlightbackground \-repeatdelay |
| 256 | \-borderwidth \-highlightcolor \-repeatinterval |
| 257 | \-cursor \-highlightthickness \-takefocus |
| 258 | \-font \-orient \-troughcolor |
| 259 | .SE |
| 260 | .SH "WIDGET-SPECIFIC OPTIONS" |
| 261 | .OP \-bigincrement bigIncrement BigIncrement |
| 262 | Some interactions with the scale cause its value to change by |
| 263 | ``large'' increments; this option specifies the size of the |
| 264 | large increments. If specified as 0, the large increments default |
| 265 | to 1/10 the range of the scale. |
| 266 | .OP \-command command Command |
| 267 | Specifies the prefix of a Tcl command to invoke whenever the scale's |
| 268 | value is changed via a widget command. |
| 269 | The actual command consists |
| 270 | of this option followed by a space and a real number indicating the |
| 271 | new value of the scale. |
| 272 | .OP \-digits digits Digits |
| 273 | An integer specifying how many significant digits should be retained |
| 274 | when converting the value of the scale to a string. |
| 275 | If the number is less than or equal to zero, then the scale picks |
| 276 | the smallest value that guarantees that every possible slider |
| 277 | position prints as a different string. |
| 278 | .OP \-from from From |
| 279 | A real value corresponding to the left or top end of the scale. |
| 280 | .OP \-label label Label |
| 281 | A string to display as a label for the scale. For |
| 282 | vertical scales the label is displayed just to the right of the |
| 283 | top end of the scale. For horizontal scales the label is displayed |
| 284 | just above the left end of the scale. If the option is specified |
| 285 | as an empty string, no label is displayed. |
| 286 | .OP \-length length Length |
| 287 | Specifies the desired long dimension of the scale in screen units |
| 288 | (i.e. any of the forms acceptable to \fBTk_GetPixels\fR). |
| 289 | For vertical scales this is the scale's height; for horizontal scales |
| 290 | it is the scale's width. |
| 291 | .OP \-resolution resolution Resolution |
| 292 | A real value specifying the resolution for the scale. |
| 293 | If this value is greater than zero then the scale's value will always be |
| 294 | rounded to an even multiple of this value, as will tick marks and |
| 295 | the endpoints of the scale. If the value is less than zero then no |
| 296 | rounding occurs. Defaults to 1 (i.e., the value will be integral). |
| 297 | .OP \-showvalue showValue ShowValue |
| 298 | Specifies a boolean value indicating whether or not the current |
| 299 | value of the scale is to be displayed. |
| 300 | .OP \-sliderlength sliderLength SliderLength |
| 301 | Specifies the size of the slider, measured in screen units along the slider's |
| 302 | long dimension. The value may be specified in any of the forms acceptable |
| 303 | to \fBTk_GetPixels\fR. |
| 304 | .OP \-sliderrelief sliderRelief SliderRelief |
| 305 | Specifies the relief to use when drawing the slider, such as \fBraised\fR |
| 306 | or \fBsunken\fR. |
| 307 | .OP \-state state State |
| 308 | Specifies one of three states for the scale: \fBnormal\fR, |
| 309 | \fBactive\fR, or \fBdisabled\fR. |
| 310 | If the scale is disabled then the value may not be changed and the scale |
| 311 | won't activate. |
| 312 | If the scale is active, the slider is displayed using the color |
| 313 | specified by the \fBactiveBackground\fR option. |
| 314 | .OP \-tickinterval tickInterval TickInterval |
| 315 | Must be a real value. |
| 316 | Determines the spacing between numerical |
| 317 | tick marks displayed below or to the left of the slider. |
| 318 | If 0, no tick marks will be displayed. |
| 319 | .OP \-to to To |
| 320 | Specifies a real value corresponding |
| 321 | to the right or bottom end of the scale. |
| 322 | This value may be either less than or greater than the \fBfrom\fR option. |
| 323 | .OP \-variable variable Variable |
| 324 | Specifies the name of a global variable to link to the scale. Whenever the |
| 325 | value of the variable changes, the scale will update to reflect this |
| 326 | value. |
| 327 | Whenever the scale is manipulated interactively, the variable |
| 328 | will be modified to reflect the scale's new value. |
| 329 | .OP \-width width Width |
| 330 | Specifies the desired narrow dimension of the trough in screen units |
| 331 | (i.e. any of the forms acceptable to \fBTk_GetPixels\fR). |
| 332 | For vertical scales this is the trough's width; for horizontal scales |
| 333 | this is the trough's height. |
| 334 | .BE |
| 335 | |
| 336 | .SH DESCRIPTION |
| 337 | .PP |
| 338 | The \fBscale\fR command creates a new window (given by the |
| 339 | \fIpathName\fR argument) and makes it into a scale widget. |
| 340 | Additional |
| 341 | options, described above, may be specified on the command line |
| 342 | or in the option database |
| 343 | to configure aspects of the scale such as its colors, orientation, |
| 344 | and relief. The \fBscale\fR command returns its |
| 345 | \fIpathName\fR argument. At the time this command is invoked, |
| 346 | there must not exist a window named \fIpathName\fR, but |
| 347 | \fIpathName\fR's parent must exist. |
| 348 | .PP |
| 349 | A scale is a widget that displays a rectangular \fItrough\fR and a |
| 350 | small \fIslider\fR. The trough corresponds to a range |
| 351 | of real values (determined by the \fBfrom\fR, \fBto\fR, and |
| 352 | \fBresolution\fR options), |
| 353 | and the position of the slider selects a particular real value. |
| 354 | The slider's position (and hence the scale's value) may be adjusted |
| 355 | with the mouse or keyboard as described in the \fBBINDINGS\fR |
| 356 | section below. Whenever the scale's value is changed, a Tcl |
| 357 | command is invoked (using the \fBcommand\fR option) to notify |
| 358 | other interested widgets of the change. |
| 359 | In addition, the value |
| 360 | of the scale can be linked to a Tcl variable (using the \fBvariable\fR |
| 361 | option), so that changes in either are reflected in the other. |
| 362 | .PP |
| 363 | Three annotations may be displayed in a scale widget: a label |
| 364 | appearing at the top right of the widget (top left for horizontal |
| 365 | scales), a number displayed just to the left of the slider |
| 366 | (just above the slider for horizontal scales), and a collection |
| 367 | of numerical tick marks just to the left of the current value |
| 368 | (just below the trough for horizontal scales). Each of these three |
| 369 | annotations may be enabled or disabled using the |
| 370 | configuration options. |
| 371 | .SH "WIDGET COMMAND" |
| 372 | .PP |
| 373 | The \fBscale\fR command creates a new Tcl command whose |
| 374 | name is \fIpathName\fR. This |
| 375 | command may be used to invoke various |
| 376 | operations on the widget. It has the following general form: |
| 377 | .CS |
| 378 | \fIpathName option \fR?\fIarg arg ...\fR? |
| 379 | .CE |
| 380 | \fIOption\fR and the \fIarg\fRs |
| 381 | determine the exact behavior of the command. The following |
| 382 | commands are possible for scale widgets: |
| 383 | .TP |
| 384 | \fIpathName \fBcget\fR \fIoption\fR |
| 385 | Returns the current value of the configuration option given |
| 386 | by \fIoption\fR. |
| 387 | \fIOption\fR may have any of the values accepted by the \fBscale\fR |
| 388 | command. |
| 389 | .TP |
| 390 | \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 391 | Query or modify the configuration options of the widget. |
| 392 | If no \fIoption\fR is specified, returns a list describing all of |
| 393 | the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 394 | information on the format of this list). If \fIoption\fR is specified |
| 395 | with no \fIvalue\fR, then the command returns a list describing the |
| 396 | one named option (this list will be identical to the corresponding |
| 397 | sublist of the value returned if no \fIoption\fR is specified). If |
| 398 | one or more \fIoption\-value\fR pairs are specified, then the command |
| 399 | modifies the given widget option(s) to have the given value(s); in |
| 400 | this case the command returns an empty string. |
| 401 | \fIOption\fR may have any of the values accepted by the \fBscale\fR |
| 402 | command. |
| 403 | .TP |
| 404 | \fIpathName \fBcoords \fR?\fIvalue\fR? |
| 405 | Returns a list whose elements are the x and y coordinates of |
| 406 | the point along the centerline of the trough that corresponds |
| 407 | to \fIvalue\fR. |
| 408 | If \fIvalue\fR is omitted then the scale's current value is used. |
| 409 | .TP |
| 410 | \fIpathName \fBget\fR ?\fIx y\fR? |
| 411 | If \fIx\fR and \fIy\fR are omitted, returns the current value |
| 412 | of the scale. If \fIx\fR and \fIy\fR are specified, they give |
| 413 | pixel coordinates within the widget; the command returns |
| 414 | the scale value corresponding to the given pixel. |
| 415 | Only one of \fIx\fR or \fIy\fR is used: for horizontal scales |
| 416 | \fIy\fR is ignored, and for vertical scales \fIx\fR is ignored. |
| 417 | .TP |
| 418 | \fIpathName \fBidentify\fR \fIx y\fR |
| 419 | Returns a string indicating what part of the scale lies under |
| 420 | the coordinates given by \fIx\fR and \fIy\fR. |
| 421 | A return value of \fBslider\fR means that the point is over |
| 422 | the slider; \fBtrough1\fR means that the point is over the |
| 423 | portion of the slider above or to the left of the slider; |
| 424 | and \fBtrough2\fR means that the point is over the portion |
| 425 | of the slider below or to the right of the slider. |
| 426 | If the point isn't over one of these elements, an empty string |
| 427 | is returned. |
| 428 | .TP |
| 429 | \fIpathName \fBset\fR \fIvalue\fR |
| 430 | This command is invoked to change the current value of the scale, |
| 431 | and hence the position at which the slider is displayed. \fIValue\fR |
| 432 | gives the new value for the scale. |
| 433 | The command has no effect if the scale is disabled. |
| 434 | .SH BINDINGS |
| 435 | .PP |
| 436 | Tk automatically creates class bindings for scales that give them |
| 437 | the following default behavior. |
| 438 | Where the behavior is different for vertical and horizontal scales, |
| 439 | the horizontal behavior is described in parentheses. |
| 440 | .IP [1] |
| 441 | If button 1 is pressed in the trough, the scale's value will |
| 442 | be incremented or decremented by the value of the \fBresolution\fR |
| 443 | option so that the slider moves in the direction of the cursor. |
| 444 | If the button is held down, the action auto-repeats. |
| 445 | .IP [2] |
| 446 | If button 1 is pressed over the slider, the slider can be dragged |
| 447 | with the mouse. |
| 448 | .IP [3] |
| 449 | If button 1 is pressed in the trough with the Control key down, |
| 450 | the slider moves all the way to the end of its range, in the |
| 451 | direction towards the mouse cursor. |
| 452 | .IP [4] |
| 453 | If button 2 is pressed, the scale's value is set to the mouse |
| 454 | position. If the mouse is dragged with button 2 down, the scale's |
| 455 | value changes with the drag. |
| 456 | .IP [5] |
| 457 | The Up and Left keys move the slider up (left) by the value |
| 458 | of the \fBresolution\fR option. |
| 459 | .IP [6] |
| 460 | The Down and Right keys move the slider down (right) by the value |
| 461 | of the \fBresolution\fR option. |
| 462 | .IP [7] |
| 463 | Control-Up and Control-Left move the slider up (left) by the |
| 464 | value of the \fBbigIncrement\fR option. |
| 465 | .IP [8] |
| 466 | Control-Down and Control-Right move the slider down (right) by the |
| 467 | value of the \fBbigIncrement\fR option. |
| 468 | .IP [9] |
| 469 | Home moves the slider to the top (left) end of its range. |
| 470 | .IP [10] |
| 471 | End moves the slider to the bottom (right) end of its range. |
| 472 | .PP |
| 473 | If the scale is disabled using the \fBstate\fR option then |
| 474 | none of the above bindings have any effect. |
| 475 | .PP |
| 476 | The behavior of scales can be changed by defining new bindings for |
| 477 | individual widgets or by redefining the class bindings. |
| 478 | |
| 479 | .SH KEYWORDS |
| 480 | scale, slider, trough, widget |