Last chance! 50% off unlimited learning
Sale ends in
Prompt for some data in a modal dialog box.
dlg_input(message = "Enter a value", default = "", ..., gui = .GUI)dlgInput(message = "Enter a value", default = "", ..., gui = .GUI)
# S3 method for gui
dlgInput(message = "Enter a value", default = "", ...,
gui = .GUI)
# S3 method for textCLI
dlgInput(message = "Enter a value", default = "", ...,
gui = .GUI)
# S3 method for nativeGUI
dlgInput(message = "Enter a value", default = "", ...,
gui = .GUI)
The message to display in the dialog box. Use \n
for
line break, or provide a vector of character strings, one for each line.
The default value in the text box. Single string or NULL
.
Pass further arguments to methods.
The 'gui' object concerned by this dialog box.
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).
# NOT RUN {
# Ask something...
user <- dlg_input("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")
}
# }
Run the code above in your browser using DataLab