Retrieve an integer or floating-point number from the user
Class GtkSpinButton( adjustment, climb_rate, digits )
adjustment | a GtkAdjustment, or nil. |
climb_rate | the new climb rate. |
digits | the number of decimal places to display in the spin button. |
A GtkSpinButton is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a GtkEntry, GtkSpinButton allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range.
The main properties of a GtkSpinButton are through a GtkAdjustment. See the GtkAdjustment section for more details about an adjustment's properties.
[...]
Methods | |
configure | Changes the properties of an existing spin button. |
get_adjustment | Get the adjustment associated with a GtkSpinButton |
get_digits | Fetches the precision of spin_button. |
get_increments | Gets the current step and page the increments used by spin_button. |
get_numeric | Returns whether non-numeric text can be typed into the spin button. |
get_range | Gets the range allowed for spin_button. |
get_snap_to_ticks | Returns whether the values are corrected to the nearest step. |
get_update_policy | Gets the update behavior of a spin button. See gtk_spin_button_set_update_policy(). |
get_value | Get the value in the spin_button. |
get_value_as_int | Get the value spin_button represented as an integer. |
get_wrap | Returns whether the spin button's value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. See gtk_spin_button_set_wrap(). |
new_with_range | This is a convenience constructor that allows creation of a numeric GtkSpinButton without manually creating an adjustment. |
set_adjustment | Replaces the GtkAdjustment associated with spin_button. |
set_digits | Set the precision to be displayed by spin_button. Up to 20 digit precision is allowed. |
set_increments | Sets the step and page increments for spin_button. |
set_numeric | Sets the flag that determines if non-numeric text can be typed into the spin button. |
set_range | Sets the minimum and maximum allowable values for spin_button |
set_snap_to_ticks | Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value. |
set_update_policy | Sets the update behavior of a spin button. |
set_value | Set the value of spin_button. |
set_wrap | Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. |
signal_change_value | Connect a VMSlot to the spinbutton change-value signal and return it |
signal_output | The output signal can be used to change to formatting of the value that is displayed in the spin buttons entry. |
signal_value_changed | Connect a VMSlot to the spinbutton value_changed signal and return it |
signal_wrapped | The wrapped signal is emitted right after the spinbutton wraps from its maximum to minimum value or vice-versa. |
spin | Increment or decrement a spin button's value in a specified direction by a specified amount. |
update | Manually force an update of the spin button. |
Changes the properties of an existing spin button.
GtkSpinButton.configure( adjustment, climb_rate, digits )
adjustment | a GtkAdjustment, or nil. |
climb_rate | the new climb rate. |
digits | the number of decimal places to display in the spin button. |
The adjustment, climb rate, and number of decimal places are all changed accordingly, after this function call.
Get the adjustment associated with a GtkSpinButton
GtkSpinButton.get_adjustment()
Return | the GtkAdjustment of spin_button |
Fetches the precision of spin_button.
GtkSpinButton.get_digits()
Return | the current precision |
See gtk_spin_button_set_digits().
Gets the current step and page the increments used by spin_button.
GtkSpinButton.get_increments()
Return | An array [ step increment, page increment ] |
See gtk_spin_button_set_increments().
Returns whether non-numeric text can be typed into the spin button.
GtkSpinButton.get_numeric()
Return | TRUE if only numeric text can be entered |
See gtk_spin_button_set_numeric().
Gets the range allowed for spin_button.
GtkSpinButton.get_range()
Return | An array [ min range, max range ] |
See gtk_spin_button_set_range().
Returns whether the values are corrected to the nearest step.
GtkSpinButton.get_snap_to_ticks()
Return | TRUE if values are snapped to the nearest step. |
See gtk_spin_button_set_snap_to_ticks().
Gets the update behavior of a spin button. See gtk_spin_button_set_update_policy().
GtkSpinButton.get_update_policy()
Return | the current update policy (GtkSpinButtonUpdatePolicy) |
Get the value in the spin_button.
GtkSpinButton.get_value()
Return | the value of spin_button |
Get the value spin_button represented as an integer.
GtkSpinButton.get_value_as_int()
Return | the value of spin_button |
Returns whether the spin button's value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. See gtk_spin_button_set_wrap().
GtkSpinButton.get_wrap()
Return | TRUE if the spin button wraps around |
This is a convenience constructor that allows creation of a numeric GtkSpinButton without manually creating an adjustment.
GtkSpinButton.new_with_range( min, max, step )
min | Minimum allowable value |
max | Maximum allowable value |
step | Increment added or subtracted by spinning the widget |
Return | The new spin button. |
The value is initially set to the minimum value and a page increment of 10 * step is the default. The precision of the spin button is equivalent to the precision of step.
Note that the way in which the precision is derived works best if step is a power of ten. If the resulting precision is not suitable for your needs, use gtk_spin_button_set_digits() to correct it.
Replaces the GtkAdjustment associated with spin_button.
GtkSpinButton.set_adjustment( adjustment )
adjustment | a GtkAdjustment to replace the existing adjustment |
Set the precision to be displayed by spin_button. Up to 20 digit precision is allowed.
GtkSpinButton.set_digits( digits )
digits | the number of digits after the decimal point to be displayed for the spin button's value |
Sets the step and page increments for spin_button.
GtkSpinButton.set_increments( step, page )
step | increment applied for a button 1 press. |
page | increment applied for a button 2 press. |
This affects how quickly the value changes when the spin button's arrows are activated.
Sets the flag that determines if non-numeric text can be typed into the spin button.
GtkSpinButton.set_numeric( numeric )
numeric | flag indicating if only numeric entry is allowed. |
Sets the minimum and maximum allowable values for spin_button
GtkSpinButton.set_range( min, max )
min | minimum allowable value |
max | maximum allowable value |
Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value.
GtkSpinButton.set_snap_to_ticks( snap_to_ticks )
snap_to_ticks | a flag indicating if invalid values should be corrected. |
Sets the update behavior of a spin button.
GtkSpinButton.set_update_policy( policy )
policy | A GtkSpinButtonUpdatePolicy value |
This determines whether the spin button is always updated or only when a valid value is set.
Set the value of spin_button.
GtkSpinButton.set_value( value )
value | the new value |
Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.
GtkSpinButton.set_wrap( wrap )
wrap | a flag indicating if wrapping behavior is performed. |
Connect a VMSlot to the spinbutton change-value signal and return it
GtkSpinButton.signal_change_value()
The output signal can be used to change to formatting of the value that is displayed in the spin buttons entry.
GtkSpinButton.signal_output()
Connect a VMSlot to the spinbutton value_changed signal and return it
GtkSpinButton.signal_value_changed()
The wrapped signal is emitted right after the spinbutton wraps from its maximum to minimum value or vice-versa.
GtkSpinButton.signal_wrapped()
Increment or decrement a spin button's value in a specified direction by a specified amount.
GtkSpinButton.spin( direction, increment )
direction | a GtkSpinType indicating the direction to spin. |
increment | step increment to apply in the specified direction. |
Manually force an update of the spin button.
GtkSpinButton.update()