start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

21.13. The Scale Widget

Create a "slider" widget representing a numeric value with the Scale method.

$parent->Scale(options);

The standard configuration options that apply to Scale are: -activebackground, -background, -bg, -borderwidth, -bw, -cursor, -font, -foreground, -fg, -highlight-background, -highlightcolor, -highlightthickness, -relief, -state, -takefocus, and -width.

Other options are:

-bigincrement => amount
The amount to change the slider when using large increments. Default is 0, which means 1/10 of the scale.

-command => callback
Pointer to a function that will be called for every incremental change in the slider.

-digits => amount
The number of digits to keep when converting from a number to a string.

-from => n
Low end of the scale (default is 0).

-label => string
The string to use as a label for the slider.

-length => amount
The length of the scale.

-orient => direction
The orientation of the slider. Values can be either vertical (default) or horizontal.

-repeatdelay => milliseconds
Determines the number of milliseconds to hold down an arrow before it auto-repeats. Default is 300.

-repeatinterval => milliseconds
Determines the number of milliseconds between auto-repeats once it is started. Default is 100.

-resolution => value
The increments that the scale will change by (default is 1).

-showvalue => boolean
Whether to show the current value of the slider (default is 1).

-sliderlength => amount
The size of the slider. Default is 25 pixels.

-tickinterval => n
The number of "ticks" to display for the slider (default is 0).

-to => n
The top value of the scale (default is 100).

-troughcolor => color
Changes the color of the trough.

-variable => \$variable
Assigns the value of the slider to the specified variable.

21.13.1. Scale Methods

In addition to configure and cget, the following methods are defined for the Scale widget:

get
Returns the current value if given no arguments. If given x and y coordinates as the first and second arguments, returns the value of the scale at that position.

set
Assigns the value associated with the scale.

coords
Returns the x and y coordinates associated with the value given in the first argument.

identify
Returns "slider", "trough1", "trough2", or "", depending on which part of the scale corresponds to the given x, y coordinates.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.