Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

Gtk::Scale

class Gtk::Scale

A Gtk::Scale is a slider control used to select a numeric value. To use it, you'll probably want to investigate the methods on its base class, Gtk::Range, in addition to the methods for Gtk::Scale itself. To set the value of a scale, you would normally use Gtk::Range#value=. To detect changes to the value, you would normally use the "value_changed" signal.

The Gtk::Scale widget is an abstract class, used only for deriving the subclasses Gtk::HScale and Gtk::VScale.

To create a scale widget, call Gtk::HScale.new or Gtk::VScale.new.

Instance Methods

layout
Gets the Pango::Layout used to display the scale. Since 2.4
  • Returns: the Pango::Layout for this scale, or nil if the draw_value property is false.
layout_offsets

Obtains the coordinates where the scale will draw the Pango::Layout representing the text in the scale. Remember when using the Pango::Layout function you need to convert to and from pixels using Pango.pixels or Pango::SCALE.

If the draw_value property is false, the return values are undefined. Since 2.4

  • Returns: [x, y]
    • X offset of layout, or nil.
    • Y offset of layout, or nil.
digits
Gets the number of decimal places that are displayed in the value.
  • Returns: the number of decimal places that are displayed.
digits=(digits)
Sets the number of decimal places that are displayed in the value. Also causes the value of the adjustment to be rounded off to this number of digits, so the retrieved value matches the value the user saw.
  • digits: the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00 etc.
  • Returns: digits
set_digits(digits)
Same as Gtk::Scale#digits=.
  • digits: the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00 etc.
  • Returns: self
draw_value?
Returns whether the current value is displayed as a string next to the slider.
  • Returns: whether the current value is displayed as a string.
draw_value=(draw_value)
Specifies whether the current value is displayed as a string next to the slider.
  • draw_value : true or false
  • Returns: draw_value
set_draw_value(draw_value)
Same as Gtk::Scale#draw_value=.
  • draw_value : true or false
  • Returns: self
value_pos
Gets the position in which the current value is displayed.
  • Returns: the position in which the current value is displayed.
value_pos=(pos)
Sets the position in which the current value is displayed.
  • pos: the position in which the current value is displayed.
  • Returns: pos
set_value_pos(pos)
Same as Gtk::Scale#value_pos=.
  • pos: the position in which the current value is displayed.
  • Returns: self
ref_accessible
See Atk::Implementor#ref_accessible.
add_child
See Gtk::Buildable#add_child.
construct_child
See Gtk::Buildable#construct_child.
get_internal_child
See Gtk::Buildable#get_internal_child.
name
See Gtk::Buildable#name.
name=
See Gtk::Buildable#name=.
set_buildable_property
See Gtk::Buildable#set_buildable_property.
set_name
See Gtk::Buildable#set_name.
builder_name
See Gtk::Buildable#builder_name.
builder_name=
See Gtk::Buildable#builder_name=.
set_builder_name
See Gtk::Buildable#set_builder_name.

Properties

digits: Integer (Read/Write)
The number of decimal places that are displayed in the value
  • Allowed values: [-1,64]
  • Default value: 1
draw-value: true or false (Read/Write)
Whether the current value is displayed as a string next to the slider
  • Default value: true
value-pos: Integer (Read/Write)
The position in which the current value is displayed

Style Properties

slider-length: Integer (Read)
Length of scale's slider
value-spacing: Integer (Read)
Space between value text and the slider/trough area

Signals

format-value: self, digits
  • self: Gtk::Scale
  • digits: the number of decimal places to display.
  • widget: the child widget of the handlebox. (this argument provides no extra information and is here only for backwards-compatibility)

ChangeLog

  • 2006-01-26 Apply 2.4 methods. Added style properties. Revised. Masao