9.2.1 Creating a Scale Widget

As with scrollbars, there are separate widget types for horizontal and vertical scale widgets. (Most programmers seem to favor horizontal scale widgets.) Since they work essentially the same way, there's no need to treat them separately here. The following methods create vertical and horizontal scale widgets, respectively:

Gtk::VScale.new( adjustment )

Gtk::VScale.new( min, max, step )

Gtk::HScale.new( adjustment );

Gtk::HScale.new( min, max, step );

The adjustment argument can either be an adjustment which has already been created with Gtk::Adjustment.new, or nil, in which case, an anonymous Adjustment is created with all of its values set to 0.0 (which isn't very useful in this case). In order to avoid confusing yourself, you probably want to create your adjustment with a page_size of 0.0 so that its upper value actually corresponds to the highest value the user can select. (If you're already thoroughly confused, read the section on Adjustments again for an explanation of what exactly adjustments do and how to create and manipulate them.)


Prev Next