gbasicdialog: Constructor for modal dialog that can contain an arbitrary...

Description Usage Arguments Value See Also Examples

View source: R/dialogs.R

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.)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

gWidgets2 documentation built on Jan. 11, 2022, 1:07 a.m.