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.
A Scrollbar
This section covers the following topics:
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. This method doesn't call the valueChanged callback. So for instance, if the scrolled view need to be adjusted to the current value, call:
getScrolledView()->adjustView()
after having set a current value to the scroll bar.
Note: When IlvScrollBar is resized, all its properties are overwritten and set back to their default values. This includes increment and page increment. |
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 dragging 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. Note that this callback is not called when the slider's position is modified by
setValues().
Published date: 05/24/2022
Last modified date: 02/24/2022