setUI {svGUI} | R Documentation |
This is the preferred way to set a property in a 'gui' object or to indicate that an UI action is about to start.
setUI(..., gui = .GUI) ## S3 method for class 'gui' setUI(fun, call, args, res, widgets, status, msg = NULL, ..., gui = .GUI) startUI(..., gui = .GUI) ## S3 method for class 'gui' startUI(fun, call, default, widgets = NULL, status = "busy-modal", msg = "Displaying a modal dialog box", msg.no.ask = "A modal dialog box was by-passed", ..., gui = .GUI)
fun |
the name of the calling function. Only required if |
call |
the call in the generic as obtained by |
args |
a list with checked and/or reworked arguments for a method. The generic can do this work, so that code does not need to be duplicated in all its methods. |
res |
any data returned by the GUI (the results). |
default |
the default value to return if the UI is by-passed because in
non interactive mode, or ask is |
widgets |
the class name of the current widgets implementation. |
status |
description of the current GUI status. Could be "ok", "busy",
"busy-modal" (a modal dialog box ius currently displayed), "by-passed" (the
GUI was by-passed because |
msg |
the message expliciting the status. Cannot be provided without status. |
msg.no.ask |
the message expliciting the status in cas the UI is by-passed. |
... |
any other property of the GUI, provided as nammed arguments. |
gui |
a 'gui' object. |
The modified 'gui' object is returned invisibly by setUI()
.
For startUI()
either TRUE
(can start the UI), or FALSE
if the Ui should be by-passed.
Philippe Grosjean <phgrosjean@sciviews.org>
## Imagine you implement a new input box ## In your function, you have this code: myInput <- function (default = "an answer", gui = .GUI) { ## Start a GUI action... or by-pass it! if (gui$startUI("myInput", call = match.call(), default = default, msg = "Displaying an imput dialog box", msg.no.ask = "An input dialog box was by-passed")) { ## Here the input dialog box is displayed and R waits from user's action ## ... [your code here] res <- "some results" # Imagine this is the text typed in the box ## When the dialog box is closed, the function should do: setUI(res = res, status = NULL) } return(invisible(gui)) }