setUI | R Documentation |
Using setUI()
is the preferred way to set a property in a gui
object.
Similarly, startUI()
should be used to indicate that an UI action requiring
user input is initiated (say, a modal input or file selection dialog box).
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 )
... |
Any other property of the GUI, provided as named arguments. |
gui |
A |
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). |
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 is currently displayed), "by-passed" (the
GUI was by-passed because |
msg |
The message that explains the status. Cannot be provided without status. |
default |
The default value to return if the UI is by-passed because in
non interactive mode, or ask is |
msg.no.ask |
The message that explains the status in case the UI is by-passed. |
gui
: Set an UI property for a gui
object.
gui
: Start an UI for a gui
object.
gui_add()
, $.gui()
# 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 input dialog box", msg.no.ask = "An input dialog box was by-passed")) { # Here the input dialog box is displayed and R waits for user feedback # ... [your code here] res <- "some results" # Imagine this is the text typed in the box # When the input dialog box is closed, the function should do: setUI(res = res, status = NULL) } invisible(gui) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.