rp.button {rpanel} | R Documentation

## Button control for rpanel

### Description

This function adds a button to the panel. A nominated function is called when the button is pressed.

### Usage

    rp.button(panel, action = I, title=deparse(substitute(action)), repeatdelay=0,
      repeatinterval=0, quitbutton=FALSE, pos=NULL, foreground=NULL,
      background=NULL, font=NULL, parentname=deparse(substitute(panel)),
      name=paste("button", .nc(), sep=""), ...)

### Arguments

`panel` | the panel in which the button should appear.
`action` | the function executed when the button is pressed.
`title` | the text displayed on the button.
`repeatinterval` | the interval between auto-repeats (milliseconds) when the button is held down.
`repeatdelay` | the time after which the button starts to auto-repeat (milliseconds).
`quitbutton` | this defaults to FALSE. Set to TRUE this creates a button which will close the window and escape from an rp.block call. Before the window is destroyed the action function will be called.
`pos` | the layout instructions. Please see the `rp.pos` example and help for full details.
`foreground` | this sets the colour of text e.g. "navy"
`background` | this sets the background colour of text e.g. "white"
`font` | this sets the text font e.g. "Arial"
`parentname` | this specifies the widget inside which the button should appear.
`name` | the name of the button.
`...` | ...

### Details

The function `action` should take one argument, which should be the panel. See `rp.grid` for details of the grid layout system.

### 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

The arguments `id` and `parent` have been discontinued in version 1.1.

### References

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

### See Also

`rp.doublebutton`,`rp.control`

### Examples

    ## Not run:
       # This function will be called on pressing the button "Simulate".
       boxp.sim <- function(panel) {
         boxplot(rnorm(50))
         panel
         }
       # Create an rpanel and add the button "Simulate" to it.
       panel <- rp.control()
       rp.button(panel, action = boxp.sim, title = "Simulate")

    ## End(Not run)

[Package rpanel version 1.1-4 Index]