Chapter 16. Adjustments

# Chapter 16. Adjustments

gtkmm has various widgets that can be visually adjusted using the mouse or the keyboard, such as the `Range` widgets (described in the Range Widgets section). There are also a few widgets that display some adjustable part of a larger area, such as the `Viewport` widget. These widgets have `Gtk::Adjustment` objects that express this common part of their API.

So that applications can react to changes, for instance when a user moves a scrollbar, `Gtk::Adjustment` has a `value_changed` signal. You can then use the `get_value()` method to discover the new value.

## Creating an Adjustment

The `Gtk::Adjustment` is created by its `create()` method which is as follows:

    Glib::RefPtr<Gtk::Adjustment> Gtk::Adjustment::create(
      double value,
      double lower,
      double upper,
      double step_increment = 1,
      double page_increment = 10,
      double page_size = 0);

The `value` argument is the initial value of the adjustment, usually corresponding to the topmost or leftmost position of an adjustable widget. The `lower` and `upper` arguments specify the possible range of values which the adjustment can hold. The `step_increment` argument specifies the smaller of the two increments by which the user can change the value, while the `page_increment` is the larger one. The `page_size` argument usually corresponds somehow to the visible area of a panning widget. The `upper` argument is used to represent the bottommost or rightmost coordinate in a panning widget's child.

Examples |  | Using Adjustments the Easy Way