gradio {gWidgets} | R Documentation

## Radio button group widget

### Description

A radio group allows the user to select one value from a set of items. The items may be displayed horizontally or vertically.

### Usage

    gradio(items, selected = 1, horizontal = FALSE, handler
    = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit())

### Arguments

`items` | Vector of values to select from
`selected` | For gradio the initial selected value (as an index) For a drop list, the first selected value. Use 0 to leave blank
`horizontal` | A logical specifying the layout for gradio and gcheckboxgroup
`handler` | Called when selection is changed
`action` | Passed to handler when called.
`container` | Optional container to attach widget to
`...` | Passed to `add` method of container
`toolkit` | Which GUI toolkit to use

### Details

The `svalue` method returns the selected value by name. If the extra argument `index=TRUE` is specified, the indices of the selected value is given.

The `svalue<-` method can be used to set the selected value. One can specify the value by name or by index if `index=TRUE` is specified.

The `"["` method refers to the vector defining the items.

The `"[<-"` method can be used to change the vector defining the items. The length will most likely need to be the same.

The `"length"` method returns the number of items.

### See Also

The radio group is one of several widgets useful to selecting a value or values from a set of items. See also `gcheckbox`, `gcheckboxgroup`, `gcombobox`, and `gtable`

Methods for gComponent objects are detailed in `gWidgets-methods`.

Event Handlers are detailed in `gWidgets-handlers`.

### Examples

    ## Not run:
      flavors <- c("vanilla", "chocolate", "strawberry")

      f <- function(h,...) print(
          paste("Yum",
          paste(svalue(h$obj),collapse=" and "),
          sep = " "))

      w <- gwindow("Radio example")
      gp <- ggroup(container=w)
      glabel("Favorite flavor:",cont=gp)
      rb <- gradio(flavors, cont=gp, handler = f)

      w <- gwindow("combobox example")
      gp <- ggroup(container=w)
      glabel("Favorite flavor:", cont=gp)
      gcombobox(flavors, editable=TRUE, cont=gp, handler=f)

      w <- gwindow("checkbox example")
      gp <- ggroup(container=w)
      glabel("Favorite flavors:",cont=gp)
      cbg <- gcheckboxgroup(flavors, cont=gp, handler=f)

      svalue(cbg) <- c(TRUE, FALSE, TRUE)
      svalue(cbg)
      cbg[3] <- "raspberry"

    ## End(Not run)

[Package gWidgets version 0.0-39 Index]