Rogue Wave Views Gadgets > Using Common Gadgets > Using IlvSlider
 
Using IlvSlider
The class IlvSlider defines a rectangular area that contains a slider. When the user moves the slider, its value changes.
Figure 11.18    Horizontal and Vertical Sliders
This section covers the following topics:
*Setting the Slider Values
*Setting the Slider Orientation
*Setting the Thumb Orientation
*Event Handling and Callbacks
Setting the Slider Values
The class IlvSlider provides an easy way to modify a value between a range.
The slider is defined by the following values:
*Its current value.
*Its minimum and maximum values.
*The slider size.
*The page increment, that is, the value added to or removed from the slider current value when clicking the areas outside the slider or when pressing the Page Up or Page Down keys.
You can set the value and the range of the slider using the member function setValues. You can set the page increment with setPageIncrement.
Setting the Slider Orientation
A slider can have four types of orientation, which are specified in the constructor. You can also change its orientation using setOrientation. The orientation of the slider can be:
*IlvLeft  Horizontal slider with minimum value on the left.
*IlvRight  Horizontal slider with minimum value on the right.
*IlvTop  Vertical slider with minimum value on the top.
*IlvBottom  Vertical slider with minimum value on the bottom.
Setting the Thumb Orientation
The thumb orientation can be also be set using the setThumbOrientation method. However, this setting is not supported by all kinds of look-and-feel styles. For example, setting the thumb orientation has no effect when using the Motif look and feel.
The following illustration shows two sliders with different thumb orientation:
Figure 11.19    The Thumb Orientation of the Sliders
Event Handling and Callbacks
When the user drags the slider, clicks outside it, or presses the arrow keys, the Home or End keys, thus causing the slider value to change, the virtual member function valueChanged is called. This member function can be overridden in subclasses to perform a specific action. Its default implementation invokes the Main callback associated with the slider. Any changes made to the slider value call the slider callback.
See Associating a Callback with a Gadget.

Version 5.6
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.