gbasicdialog {gWidgets2} | R Documentation

## Constructor for modal dialog that can contain an arbitrary widget

### Description

The basic dialog is basically a modal window. To use there is a 3 step process: 1) Create a container by calling this constructor, say `dlg`; 2) use `dlg` as a container for your subsequent GUI; 3) set the dialog to be modal by calling `visible(dlg)`. (One can't call `visible(dlg) <- TRUE`.)

generic for toolkit dispatch

We overrided the basic use of `visible` for the `gbasicdialog` container to have it become visible and modal after this call. The better suited call `visible(dlg) <- TRUE` does not work as wanted, for we want to capture the return value.

dispose method for a basic dialog

### Usage

    gbasicdialog(title = "Dialog", parent = NULL, do.buttons = TRUE,
      handler = NULL, action = NULL, ..., toolkit = guiToolkit())

    .gbasicdialog(toolkit, title = "Dialog", parent = NULL, do.buttons = TRUE,
      handler = NULL, action = NULL, ...)

    ## S3 method for class 'GBasicDialog'
    visible(obj, ...)

    ## S3 method for class 'GBasicDialog'
    dispose(obj, ...)

### Arguments

`title` | title for window
`parent` | parent to display by
`do.buttons` | FALSE to suppress buttons when no parent
`handler` | handler called when `Ok` button invoked
`action` | passed to handler for OK button
`...` | ignored
`toolkit` | toolkit
`obj` | dialog object

### Value

A `GBasicDialog` instance with a visible method

logical indicating which button was pushed (or TRUE if no buttons present)

### See Also

`gmessage`, `gconfirm`, `gbasicdialog`, `galert`

### Examples

    ## Not run:
    ## a modal dialog for editing a data frme
    fix_df <- function(DF, ...) {
      dfname <- deparse(substitute(DF))
      w <- gbasicdialog(..., handler=function(h,...) {
        assign(dfname, df[,], .GlobalEnv)
      })
      g <- ggroup(cont=w, horizontal=FALSE)
      glabel("Edit a data frame", cont=g)
      df <- gdf(DF, cont=g, expand=TRUE)
      size(w) <- c(400, 400)
      out <- visible(w)
    }

    m <- mtcars[1:3, 1:4]
    fix_df(m)

    ## End(Not run)

[Package gWidgets2 version 1.0-8 Index]