Learn R Programming

RGtk2 (version 2.8.8)

GtkSpinButton: GtkSpinButton

Description

Retrieve an integer or floating-point number from the user

Arguments

Methods and Functions

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)

Hierarchy

\link{GObject} +----\link{GtkObject} +----\link{GtkWidget} +----\link{GtkEntry} +----GtkSpinButton

Interfaces

GtkSpinButton implements AtkImplementorIface, GtkCellEditable and GtkEditable.

Detailed Description

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. # 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() } # 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() }

Convenient Construction

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.

References

http://developer.gnome.org/doc/API/2.0/gtk/GtkSpinButton.html