Chapter 7. Range Widgets

Table of Contents

Gtk::Scale inherits from Gtk::Range. Gtk::Scrollbar does not inherit from Gtk::Range, but it shares much functionality with Gtk::Scale. They both contain a "trough" and a "slider" (sometimes called a "thumbwheel" in other GUI environments). Dragging the slider with the pointer moves it 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. This should be familiar scrollbar behavior.

As will be explained in the Adjustments section, all range widgets are associated with an Adjustment object. To change the lower, upper, and current values used by the widget you need to use the methods of its Adjustment, which you can get with the get_adjustment() method. The range widgets' default constructors create an Adjustment automatically, or you can specify an existing Adjustment, maybe to share it with another widget. See the Adjustments section for further details.


Scrollbar Widgets

These are standard scrollbars. They should be used only to scroll another widget, such as a Gtk::Entry or a Gtk::Viewport, though it's usually easier to use the Gtk::ScrolledWindow widget in most cases.

The orientation of a Gtk::Scrollbar can be either horizontal or vertical.