GtkSpinButton
Retrieve an integer or floating-point number from the user
gtkSpinButtonConfigure(object, adjustment = NULL, climb.rate, digits)gtkSpinButtonNew(adjustment = NULL, climb.rate = NULL, digits = NULL, show = TRUE)gtkSpinButtonNewWithRange(min, max, step, show = TRUE)gtkSpinButtonSetAdjustment(object, adjustment)gtkSpinButtonGetAdjustment(object)gtkSpinButtonSetDigits(object, digits)gtkSpinButtonSetIncrements(object, step, page)gtkSpinButtonSetRange(object, min, max)gtkSpinButtonGetValueAsInt(object)gtkSpinButtonSetValue(object, value)gtkSpinButtonSetUpdatePolicy(object, policy)gtkSpinButtonSetNumeric(object, numeric)gtkSpinButtonSpin(object, direction, increment)gtkSpinButtonSetWrap(object, wrap)gtkSpinButtonSetSnapToTicks(object, snap.to.ticks)gtkSpinButtonUpdate(object)gtkSpinButtonGetDigits(object)gtkSpinButtonGetIncrements(object)gtkSpinButtonGetNumeric(object)gtkSpinButtonGetRange(object)gtkSpinButtonGetSnapToTicks(object)gtkSpinButtonGetUpdatePolicy(object)gtkSpinButtonGetValue(object)gtkSpinButtonGetWrap(object)gtkSpinButton(adjustment = NULL, climb.rate = NULL, digits = NULL, min, max, step, show = TRUE)
GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkEntry
+----GtkSpinButtonGtkSpinButton implements
AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.
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.
Using a GtkSpinButton to get an integer.
## Provides a function to retrieve an integer value from a GtkSpinButton
## and creates a spin button to model percentage values.
grab_int_value <- function(a_spinner, user_data) {
return(a_spinner$getValueAsInt())
}
create_integer_spin_button <- function() {
spinner_adj <- gtkAdjustment(50.0, 0.0, 100.0, 1.0, 5.0, 5.0)
window <- gtkWindow("toplevel", show = F)
window$setBorderWidth(5)
## creates the spinner, with no decimal places
spinner <- gtkSpinner(spinner_adj, 1.0, 0)
window$add(spinner)
window$showAll()
}Using a GtkSpinButton to get a floating point value.
# Provides a function to retrieve a floating point value from a
# GtkSpinButton, and creates a high precision spin button.
grab_value <- function(a_spinner, user_data) {
return(a_spinner$getValue())
}
create_floating_spin_button <- function() {
spinner_adj <- gtkAdjustment(2.500, 0.0, 5.0, 0.001, 0.1, 0.1)
window <- gtkWindow("toplevel", show = F)
window$setBorderWidth(5)
## creates the spinner, with three decimal places
spinner <- gtkSpinner(spinner_adj, 0.001, 3)
window$add(spinner)
window$showAll()
}GtkSpinButtonentry is the GtkEntry part of the GtkSpinButton
widget, and can be used accordingly. All other fields contain private data
and should only be modified using the functions below.
gtkSpinButton is the result of collapsing the constructors of GtkSpinButton (gtkSpinButtonNew, gtkSpinButtonNewWithRange) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.
GtkSpinButtonUpdatePolicy| GTK_UPDATE_ALWAYS | When refreshing your GtkSpinButton , the value is always displayed. |
| GTK_UPDATE_IF_VALID | When refreshing your GtkSpinButton , the value is only displayed if it is valid within the bounds of the spin button's GtkAdjustment . |
alwaysundocumented
if-validundocumented
GtkSpinType| GTK_SPIN_STEP_FORWARD, GTK_SPIN_STEP_BACKWARD, GTK_SPIN_PAGE_FORWARD, GTK_SPIN_PAGE_BACKWARD | These values spin a GtkSpinButton by the relevant values of the spin button's GtkAdjustment . |
| GTK_SPIN_HOME, GTK_SPIN_END | These set the spin button's value to the minimum or maxmimum possible values, (set by its GtkAdjustment ), respectively. |
| GTK_SPIN_USER_DEFINED | The programmer must specify the exact amount to spin the GtkSpinButton . |
step-forwardundocumented
step-backwardundocumented
page-forwardundocumented
page-backwardundocumented
homeundocumented
endundocumented
user-definedundocumented
change-value(spinbutton, user.data)undocumented
spinbuttonthe object which received the signal.
user.datauser data set when the signal handler was connected.
input(spinbutton, user.data)undocumented
spinbuttonthe object which received the signal.
user.datauser data set when the signal handler was connected.
output(spin.button, user.data)The ::output signal can be used to change to formatting of the value that is displayed in the spin buttons entry.
/* show leading zeros */
static gboolean
on_output (GtkSpinButton *spin,
gpointer data)
{
GtkAdjustment *adj;
gchar *text;
int value;
adj = gtk_spin_button_get_adjustment (spin);
value = (int)gtk_adjustment_get_value (adj);
text = g_strdup_printf ("%02d", value);
gtk_entry_set_text (GTK_ENTRY (spin), text);
g_free (text);
return TRUE;
}
spin.buttonthe object which received the signal
user.datauser data set when the signal handler was connected.
Returns: [logical] TRUE if the value has been displayed.
value-changed(spinbutton, user.data)undocumented
spinbuttonthe object which received the signal.
user.datauser data set when the signal handler was connected.
wrapped(spinbutton, user.data)The wrapped signal is emitted right after the spinbutton wraps from its maximum to minimum value or vice-versa. Since 2.10
spinbuttonthe object which received the signal
user.datauser data set when the signal handler was connected.
adjustment [GtkAdjustment : * : Read / Write]The adjustment that holds the value of the spinbutton.
climb-rate [numeric : Read / Write]The acceleration rate when you hold down a button. Allowed values: >= 0 Default value: 0
digits [numeric : Read / Write]The number of decimal places to display. Allowed values: <= 20 Default value: 0
numeric [logical : Read / Write]Whether non-numeric characters should be ignored. Default value: FALSE
snap-to-ticks [logical : Read / Write]Whether erroneous values are automatically changed to a spin button's nearest step increment. Default value: FALSE
update-policy [GtkSpinButtonUpdatePolicy : Read / Write]Whether the spin button should update always, or only when the value is legal. Default value: GTK_UPDATE_ALWAYS
value [numeric : Read / Write]Reads the current value, or sets a new value. Default value: 0
wrap [logical : Read / Write]Whether a spin button should wrap upon reaching its limits. Default value: FALSE
shadow-type [GtkShadowType : Read]the type of border that surrounds the arrows of a spin button. Default value: GTK_SHADOW_IN
Derived by RGtkGen from GTK+ documentation
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.