dlgInput: A simple input box

Description Usage Arguments Value Author(s) See Also Examples

View source: R/dlgInput.R

Description

Enter one (textual) value with this input box.

Usage

1
2
3
4
5
6
7
8
9
dlgInput(message = "Enter a value", default = "", ..., gui = .GUI)

## These should not be called directly
## S3 method for class 'gui'
dlgInput(message = "Enter a value", default = "", ..., gui = .GUI)
## S3 method for class 'textCLI'
dlgInput(message = "Enter a value", default = "", ..., gui = .GUI)
## S3 method for class 'nativeGUI'
dlgInput(message = "Enter a value", default = "", ..., gui = .GUI)

Arguments

message

the message to display in the dialog box. Use \n for line break, or provide a vector of character strings, one for each line.

default

the default value in the text box. Single string or NULL.

...

pass further arguments to methods.

gui

the 'gui' object concerned by this dialog box.

Value

The modified 'gui' object is returned invisibly. The text entered by the user at the input box, or an empty string if the dialog box was cancelled can be obtained from gui$res (see example).

Author(s)

Philippe Grosjean ([email protected])

See Also

dlgMessage

Examples

1
2
3
4
5
6
7
## Ask something...
user <- dlgInput("Who are you?", Sys.info()["user"])$res
if (!length(user)) { # The user clicked the 'cancel' button
    cat("OK, you prefer to stay anonymous!\n")
} else {
    cat("Hello", user, "\n")
}

Example output

Loading required package: svGUI
Hello unknown 

svDialogs documentation built on May 29, 2017, 3:34 p.m.