gradio: Radio button group

Description Usage Arguments Value Note Examples

View source: R/gradio.R

Description

A basic radio button group. Specify the labels through items. The main value is the label or index.

Usage

1
2
3
gradio(items, selected = 1, horizontal = FALSE, handler = NULL,
  action = NULL, container = NULL, ..., width = NULL, height = NULL,
  ext.args = NULL, columns = ifelse(horizontal, length(items), 1))

Arguments

items

Vector of items to choose one from.

selected

index of initially selected item

horizontal

logical. Horizontal or vertical layout. (See also columns)

handler

optional means (to addHandlerChanged) to specify a handler for the default signal. A handler is a function with signature (h,...) where h is a list with components obj referring to the object emitting the signal, action containing values passed to the action argument, and possible other values.

action

Passed to handler to parameterize a call

container

A parent container. In gWidgetsWWW2 a parent container is not optional (though it can be substituted with the parent argument in some circumstances). The parent specifies the widget heirarchy and the ... argument is used to pass along arguments to layout the child component in the parent container. Typically, these are passed to the add method of the parent container.

...

Used to pass along argument to the parent container's add method and possible other arguments to the underlying ference class constructors.

width

width in pixels of component. Sizing in gWidgetsWWW2 is sometimes necessary as the arguments expand and fill are not well implemented.

height

height in pixels of the component.

ext.args

The contructors of gWidgetsWWW2 ultimately call an Ext constructor. The options passed to the Ext constructor may be added to or overridden by use of this argument. Values are passed in as named list components and with values converted into JavaScript objects by asJSObject.

columns

Can be used to override horizontal TRUE or FALSE

Value

a GRadio reference class object

Note

the [<- method (to change the labels) is not implemented.

Examples

1
2
3
4
5
6
7
8
9
w <- gwindow()
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
rb <- gradio(state.name[1:4], cont=w)
addHandlerChanged(rb, handler=function(h,...) {
  galert(paste("You clicked", svalue(h$obj)), parent=w)
})
svalue(rb, index=TRUE) <- 1 # by index
svalue(rb) <- state.name[2] # by value
## rb[] <- state.name[1:6] ## doesn't work!

jverzani/gWidgetsWWW2 documentation built on Feb. 9, 2020, 5:18 p.m.