Class ::tycho::Slider


Inherits: ::tycho::TWidget - Source File - Contents: itk_options - public methods
A slider widget. This widget provides an alternative to the Tk scale widget, and is supposed to be reminiscent of a vertical ``slider'' as used in audio equipment. It also provides a good example of how Tycho's Slate widget can be used to (relatively) quickly create new interactive components.

To create a simple slider:

   ::tycho::Displayer .d
   ::tycho::Slider .d.s -label Fred -resolution 0.5 -to 11 -command puts
   pack .d.s
   .d centerOnScreen

To move the slider, use the left button on the horizontal ``bar'' and click and drag. Clicking the left button anywhere near the vertical ``trough'' but not on the bar will cause the bar to move in increments. Clicking the middle button anywhere near the trough will cause the bar to jump to that position; it can then be dragged.

Slider uses the following interactor classes:

.

Itk_options

-command
The command prefix to be called whenever the slider moves.
-digits 1
The number of significant digits to display.
-from 0
The value when the slider is at the bottom.
NOTE: This value must always be greater than the to option.
-label .
The slider's label, which appears underneath it. FIXME: Can't have an empty label.
-length 108
The vertical movement of the slider.
-resolution 0
The resolution of the slider. If zero, the resolution is exactly one pixel. The interactors are set up to quantize movement of the bar if resolution is non-zero. When set, the bar is moved to a multiple of the resolution.
-scale linear
The type of scale: linear or log. NOT IMPLEMENTED..
-to 10
The value when the slider is at the top.
NOTE: This value must always be greater than the from option.
-totalwidth 34
The total width of the slider widget.
-width 4
The width of the slider trough.

Public constructs

Public Methods

get
Get the current slider value from its position.
set x
Set the slider to a specified value.
up
Move the slider up. If the resolution option is non-zero, move it that far; if it is zero, move it one pixel. In either case, don't move past the end of the trough.
down
Move the slider down. If the resolution option is non-zero, move it that far; if it is zero, move it one pixel. In either case, don't move past the end of the trough.

Index of classes



Author: H. John Reekie and William Chen
Version: @(#)Slider.itcl 1.17 12/12/96
Copyright: (c) 1996 The Regents of the University of California.