rp.combo {rpanel} | R Documentation

## A ‘combo’ for a panel

### Description

This function adds a ‘combobox’ to the panel. When an item is pressed, a variable is set and an action function is called.

### Usage

    rp.combo(panel, variable, prompt=NULL, vals, initval=vals[1], pos=NULL, action=I,
      foreground=NULL, background=NULL, font=NULL, editable=FALSE,
      parentname=deparse(substitute(panel)), name=paste("combo", .nc(), sep=""), ...)

### Arguments

`panel` | the panel in which the combobox should appear.
`variable` | the name of the variable whose value is set by the combobox.
`prompt` | the label for the combobox.
`vals` | the values of `variable` used by the combo.
`initval` | the initial value of `variable` (optional). The initial value can also be specified in the call to `rp.control`.
`pos` | the layout instructions. Please see the `rp.pos` example and help for full details.
`action` | the function which is called when an item is chosen.
`foreground` | colour of the text
`background` | colour of the text background
`font` | font to be used
`editable` | whether the combobox can be edited or not.
`parentname` | this specifies the widget inside which the combobox should appear.
`name` | name assigned to the combobox, used for disposing of the widget
`...` | ...

### Details

The function `action` should take one argument, which should be the panel to which the combobox is attached.

See `rp.grid` for details of the grid layout system.

### Value

If the parameter panel is the panelname string the same string is returned. If the panel object is used the altered panel is assigned to both the calling level and panel's environment level.

### Warning

The `action` function should return the panel. Without this assignment any widgets added or alterations made to panel parameters within the `action` function will be lost.

### Note

Parameters `parent` and `...` have been discontinued in version 1.1. Note that the argument previously named `var` has been renamed `variable` to avoid reserved word issues.

### References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

### See Also

`rp.checkbox`,`rp.control`

### Examples

    ## Not run:
       callback <- function(panel) {
          print(panel$option)
          panel
       }
       panel <- rp.control()
       rp.combo(panel, option, "Pick an option:",
                c("Option1","Option2","Other options"), action=callback)

    ## End(Not run)

[Package rpanel version 1.1-4 Index]