GtkSpinButton {RGtk2}R Documentation

GtkSpinButton

Description

Retrieve an integer or floating-point number from the user

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

GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkEntry
                           +----GtkSpinButton

Interfaces

GtkSpinButton implements AtkImplementorIface, GtkBuildable, GtkEditable and GtkCellEditable.

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.

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

Structures

GtkSpinButton

entry 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.

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.

Enums and Flags

Signals

Properties

Style Properties

shadow-type
[GtkShadowType : Read]

the type of border that surrounds the arrows of a spin button. Default value: GTK_SHADOW_IN

Author(s)

Derived by RGtkGen from GTK+ documentation

References

http://library.gnome.org/devel//gtk/GtkSpinButton.html


[Package RGtk2 version 2.20.21 Index]