Learn R Programming

gWidgets (version 0.0-25)

gslider: Constructors for widgets to select a value from a sequence.

Description

The gslider widget and gspinbutton widget allow the user to select a value from a sequence using the mouse. In the slider case, a slider is dragged left or right (or up or down) to change the value. For a spin button a text box with arrows beside allow the user to scroll through the values by clicking the arrows.

Usage

gslider(from = 0, to = 100, by = 1, value = from, horizontal = TRUE, handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())

gspinbutton (from = 0, to = 10, by = 1, value = from, digits = 0, handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())

Arguments

Details

The svalue method returns the selected value.

The svalue<- method is used to set the selected value.

The addhandlerchanged handler is called when the widgets' value is changed.

Examples

Run this code
x = rnorm(100)
  plotHist = function(shade = .5) hist(x, col=gray(shade))

  group = ggroup(horizontal =FALSE, container=TRUE)
  glabel("Slide value to adjust shade", container=group)
  gslider(from=0,to=1,by=0.05,value=.5, container=group,
  handler=function(h,...)  plotHist(svalue(h$obj)))

Run the code above in your browser using DataLab