[ Previous |
Motif 2.1 Programmer's Guide
A widget can act as a viewport onto a virtual scroll. The
ScrollBar is the control that moves the viewport horizontally or vertically
relative to the underlying scroll. A ScrollBar consists of a rectangle, called
the scroll region, representing the full size of the scroll. It has a smaller
rectangle, called the slider, within the scroll region, representing the
position and size of the viewport relative to the full scroll. The ScrollBar
usually has arrow graphics at both ends of the larger rectangle.
A ScrollBar has translations and actions that allow the user to move the
slider. By clicking on an arrow, the user moves the slider one small increment
in the direction of the arrow. By clicking in the scroll region between an
arrow and the slider, the user moves the slider a larger increment (the page
increment) in the direction of the arrow. When the ScrollBar has keyboard
focus, the user can use the keyboard to move the slider in this way. The user
can also drag the slider using the mouse.
By itself, the ScrollBar does not have an association with a widget acting
as a viewport onto a scroll. Most applications use a ScrolledWindow, a Manager
widget with a child to be scrolled and possibly with one or two ScrollBars to
control the scrolling. ScrolledWindow can automatically control the
interaction between the scrolled child and the ScrollBars, or it can allow the
application to control the interaction. For more information see Chapter 8.
ScrollBar has a number of resources that allow the application to use it to
A minimum value (XmNminimum), representing the position of the slider at
one end of the scroll region, and a maximum value (XmNmaximum), representing
the position of the slider at the other end of the scroll region. These values
can be in any integral units the application chooses, so long as the maximum
is greater than the minimum.
The length of the slider (XmNsliderSize) between 1 and (XmNmaximum -
A value (XmNvalue), ranging between XmNminimum and (XmNmaximum -
XmNsliderSize), representing the current position of the slider between the
maximum and minimum values.
Values for the increment (XmNincrement) and page increment
(XmNpageIncrement) by which the user can move the slider.
A resource (XmNprocessingDirection) that determines whether the minimum
value is on the left or right for horizontal ScrollBars or is on the bottom or
top for vertical ScrollBars.
Distinct callbacks that the widget invokes when the user moves the slider
by one increment in either direction, by one page increment in either
direction, or all the way to either end of the scroll region. The widget
invokes other callbacks as the user drags the slider and when the user stops
dragging the slider. The application does not have to provide routines for all
these callback lists; if it provides only an XmNvalueChangedCallback
procedure, the widget invokes that procedure whenever the ScrollBar value
changes (except during interactive dragging of the slider).
Resources to control the color of the scroll region, whether the ScrollBar
is horizontal or vertical, and whether or not the ScrollBar has arrows.
Resources to control the delays before the widget moves the slider
continuously as the user presses and holds Btn1 on an arrow or the scroll
A resource (XmNsnapBackMultiple to specify the distance over which the
ScrollBar slider snaps back to its original position when the user drags the
mouse outside the ScrollBar edge.
Resources to specify the appearance of the slider (XmNsliderMark and
A resource (XmNslidingMode) to specify the mode the slider works in. For
example, this resource could make the ScrollBar look like an old-fashioned
mercury thermometer (XmTHERMOMETER mode) or like a carpenter's level
Two convenience routines, XmScrollBarGetValues and XmScrollBarSetValues,
allow the application to get and set the value, slider size, increment, and
page increment in one call.
[ Previous |