Using Adjustments the Easy Way
| Chapter 12. Adjustments |

## Using Adjustments the Easy Way

The adjustable widgets can be roughly divided into those which use and require specific units for these values, and those which treat them as arbitrary numbers.

The group which treats the values as arbitrary numbers includes the `Range` widgets (`Scrollbars` and `Scales`, the `Progressbar` widget, and the `SpinButton` widget). These widgets are typically "adjusted" directly by the user with the mouse or keyboard. They will treat the `lower` and `upper` values of an adjustment as a range within which the user can manipulate the adjustment's `value`. By default, they will only modify the `value` of an adjustment.

The other group includes the `Viewport` widget and the `ScrolledWindow` widget. All of these widgets use pixel values for their adjustments. These are also typically adjusted indirectly using scrollbars. While all widgets which use adjustments can either create their own adjustments or use ones you supply, you'll generally want to let this particular category of widgets create its own adjustments.

TODO: Text widget is deprecated: Look at GTK+ tutorial for up-to-date example. If you share an adjustment object between a Scrollbar and a Text widget, manipulating the scrollbar will automagically adjust the Text widget. You can set it up like this:

    // creates its own adjustments
    Gtk::Text text(0, 0);
    // uses the newly-created adjustment for the scrollbar as well
    Gtk::VScrollbar vscrollbar (*(text.get_vadjustment()));

Chapter 12. Adjustments |  | Adjustment Internals