The category of range widgets includes the ubiquitous scrollbar
widget and the less common "scale" widget. Though these two types
of widgets are generally used for different purposes, they are
quite similar in function and implementation. All range widgets
share a set of common graphic elements, each of which has its own X
window and receives events. They all contain a "trough" and a
"slider" (what is sometimes called a "thumbwheel" in other GUI
environments). Dragging the slider with the pointer moves it back
and forth within the trough, while clicking in the trough advances
the slider towards the location of the click, either completely, or
by a designated amount, depending on which mouse button is used.
As mentioned in the W(Adjustment) page, all range widgets are
associated with an adjustment object, from which they calculate the
length of the slider and its position within the trough. When the
user manipulates the slider, the range widget will change the value
of the adjustment.
All of the GTK range widgets react to mouse clicks in more or less
the same way. Clicking button-1 in the trough will cause its
adjustment's page_increment to be added or subtracted from its
value, and the slider to be moved accordingly. Clicking mouse
button-2 in the trough will jump the slider to the point at which
the button was clicked. Clicking any button on a scrollbar's arrows
will cause its adjustment's value to change step_increment at a
time.
It may take a little while to get used to, but by default,
scrollbars as well as scale widgets can take the keyboard focus in
GTK. If you think your users will find this too confusing, you can
always disable this by unsetting the GTK.CanFocus flag on the
scrollbar, like this:
scrollbar->unset_flag( GTK.CanFocus );
The key bindings (which are, of course, only active when the widget
has focus) are slightly different between horizontal and vertical
range widgets, for obvious reasons. They are also not quite the
same for scale widgets as they are for scrollbars, for somewhat
less obvious reasons (possibly to avoid confusion between the keys
for horizontal and vertical scrollbars in scrolled windows, where
both operate on the same area).