R: Set a property in the UI (User Interface), or start an action

setUI {svGUI} | R Documentation

## Set a property in the UI (User Interface), or start an action

### Description

This is the preferred way to set a property in a 'gui' object or to indicate that an UI action is about to start.

### Usage

    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)

### Arguments

`fun` | the name of the calling function. Only required if `call` is provided.
`call` | the call in the generic as obtained by `match.call()`
`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 `FALSE`.
`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 `dontAsk()` returns `TRUE`), "error", or any other status indicator suitable for the current state of your GUI.
`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.

### Value

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.

### Author(s)

Philippe Grosjean <phgrosjean@sciviews.org>

### See Also

`guiAdd`, `$.gui`

### Examples

    ## 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))
    }

[Package svGUI version 0.9-55 Index]