9.2.2 Methods and Signals (well, methods at least)

Scale widgets can display their current value as a number beside the trough. The default behavior is to show the value, but you can change this with these methods:

Gtk::Scale#set_draw_value( draw_value )
Gtk::Scale#draw_value=( draw_value )

As you might have guessed, draw_value is either true or false, with predictable consequences for either one.

The value displayed by a scale widget is rounded to one decimal point by default, as is the value field in its Adjustment. You can change this with one of these methods:

Gtk::Scale#set_digits( digits )
Gtk::Scale::#digits=( digits )

where digits is the number of decimal places you want. You can set digits to anything you like, but no more than 13 decimal places will actually be drawn on screen.

Finally, the value can be drawn in different positions relative to the trough:

Gtk::Scale#set_value_pos( pos )
Gtk::Scale#value=( pos )

The argument pos is a Gtk::PositionType, which can take one of the following values:

Gtk::POS_LEFT
Gtk::POS_RIGHT
Gtk::POS_TOP
Gtk::POS_BOTTOM

If you position the value on the "side" of the trough (e.g., on the top or bottom of a horizontal scale widget), then it will follow the slider up and down the trough.


Prev Next