Gadgets > Rogue Wave Views Gadgets > Using Common Gadgets > Using IlvScrollBar
 
Using IlvScrollBar
The class IlvScrollBar defines a rectangular area with two arrows and a slider used for scrolling through a window. This rectangular area is called a scrollbar.
Figure 11.17    A Scrollbar
This section covers the following topics:
*Setting the Scrollbar Values
*Setting the Scrollbar Orientation
*Event Handling and Callbacks
Setting the Scrollbar Values
A scrollbar is defined by the following values:
*Its current value.
*Its minimum and maximum values.
*The slider size.
*The increment, that is, the value added to or removed from the scrollbar current value when clicking the scrollbar arrows or when pressing the Left, Right, Up or Down keys.
*The page increment, that is, the value added to or removed from the current scrollbar value when clicking the areas between the slider and the arrows or when pressing the Page-Up or Page-Down keys.
The current value of the scrollbar can change within the minimum value and the (maximum - slider size) value.
Use the setValues method to set the current value of the scrollbar and its minimum and maximum values.
Use the setIncrement and setPageIncrement methods to set the increment and the page increment.
Setting the Scrollbar 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.
Event Handling and Callbacks
When the user drags the slider, thus causing the scrollbar value to change, the virtual member function drag is called. This member function can be overridden in subclasses. Its default implementation invokes the member function valueChanged.
valueChanged is also called when the user clicks the scrollbar arrows or the area located between the slider and the arrows, or when the user presses the arrow keys or the Home and End keys. This virtual member function can be overridden in subclasses. Its default implementation invokes the Main callback associated with the scrollbar.
When the user releases the slider, after he dragged it, the virtual member function dragged is called. This member function can be overridden in subclasses. Its default implementation invokes the secondary callback associated with the scrollbar.
See Associating a Callback with a Gadget.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.