rp.textentry {rpanel} | R Documentation

## Text entry boxes for a panel

### Description

This function adds one or more boxes which allow text to be entered.

### Usage

    rp.textentry(panel, variable, action = I, labels = NULL, names = labels,
      title = NULL, initval = rep(NA, length(labels)), pos = NULL,
      foreground = NULL, background = NULL, font = NULL, width = 20, keydown = FALSE,
      parentname = deparse(substitute(panel)), name = paste("textentry", .nc(), sep=""), ...)

### Arguments

`panel` | the panel in which the text entry box(es) should appear. This may be passed as a panelname string or the panel object itself.
`variable` | the name of the variable which will be assigned the text entered into the box(es).
`action` | the function which is called when the text has been entered.
`labels` | a character string of labels for the text entry boxes.
`names` | a character string of the names of the elements of `variable` which can be referred to within action functions.
`title` | title above multiple textentries
`initval` | the initial value(s) for var (optional). The initial value(s) 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.
`foreground` | colour of the text
`background` | colour of the text background
`font` | font to be used
`width` | character width of the textboxes
`keydown` | if TRUE the action function will be called on every keypress - this may not be wise
`parentname` | this specifies the widget inside which the text entry widget should appear. In the current version, it should not normally be used.
`name` | name assigned to the textentries; used for disposal etc
`...` | ...

### Details

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

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

### Value

If the argument `panel` is set to 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

The former arguments `names`, `title` and `parent` have been discontinued in version 1.1. Note also that the argument `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.control`

### Examples

    ## Not run:
       plotf <- function(panel) {
          with(panel, {
    		 pars   <- as.numeric(pars)
             xgrid <- seq(0.1, max(c(pars[3], 5), na.rm = TRUE), length = 50)
             dgrid <- df(xgrid, pars[1], pars[2])
             plot(xgrid, dgrid, type = "l", col = "blue", lwd = 3)
             if (!is.na(pars[3])) {
                lines(rep(pars[3], 2), c(0, 0.95 * max(dgrid)), lty = 2, col = "red")
                text(pars[3], max(dgrid), as.character(pars[3]), col = "red")
                }
             })
          panel
          }

       panel <- rp.control(pars = c(5, 10, NA))
       rp.textentry(panel, pars, plotf, labels = c("df1", "df2", "observed"),
              initval = c(10, 5, 3))
       rp.do(panel, plotf)

    ## End(Not run)

[Package rpanel version 1.1-4 Index]