| dlg_form {svDialogs} | R Documentation |
Modal dialog to fill a series of different fields.
Description
A customizable form dialog box with checkboxes, entries, lists, etc.
Usage
dlg_form(
form,
title = "Fill the form",
message = NULL,
columns = 1,
strip.type = TRUE,
...,
gui = .GUI
)
dlgForm(
form,
title = "Fill the form",
message = NULL,
columns = 1,
strip.type = TRUE,
...,
gui = .GUI
)
## S3 method for class 'gui'
dlg_form(
form,
title = "Fill the form",
message = NULL,
columns = 1,
strip.type = TRUE,
...,
gui = .GUI
)
## S3 method for class 'textCLI'
dlg_form(
form,
title = "Fill the form",
message = NULL,
columns = 1,
strip.type = TRUE,
...,
gui = .GUI
)
## S3 method for class 'nativeGUI'
dlg_form(
form,
title = "Fill the form",
message = NULL,
columns = 1,
strip.type = TRUE,
...,
gui = .GUI
)
Arguments
form |
Named list of default values, or list of possible items. Names are the labels of corresponding entries in the dialog box, followed by an indicator of the type of entry to place in the dialog box (see details). |
title |
The title of the form. |
message |
An optional message to display in the dialog box. Use
|
columns |
Arrange the entries on this number of columns (by row). |
strip.type |
Do we strip the type from the names in results? |
... |
Pass further arguments to methods. |
gui |
The 'gui' object concerned by this dialog box. |
Details
The form content is defined by a named list. Items are default values, or a list of possible items, e.g., for the combobox. Names are labels displayed in front of each field in the form. Follow them by a code that represents the type of entry you want to use:
-
:TXTfor simple (default) textual box, -
:Hfor hidden text (password), -
:ROfor read-only text, -
:NUMfor null of positive integers with up/down arrows, -
:CHKfor checkbox:TRUEorFALSE, -
:CBfor read-only combobox, -
:CBEfor editable combobox, -
:FLto select one existing file, -
:MFLto select multiple existing files, -
:SFLto select or create one file, -
:DIRto select a directory, -
:CDIRto select or create a directory, -
:FNto select font and font size, -
:DTto enter a date, :CLR' to enter a RGB color,
:BTN' to create a button that execute some code,
-
:LBLto add a label.
For the moment, the form dialog box is only supported on Linux. You have to
install yad to get access to it. On Ubuntu, you do so by
sudo apt-get install yad. For other system, look at the documentation.
Value
The modified 'gui' object is returned invisibly. Use its gui$res
component to get the list of returned fields.
Note
dlg_form() can use strings with embedded quotes, but you have to
escape them (and need to double the backslash escape sign). Currently,
this is not done automatically, on the contrary to the other dlg_xxx()
functions!
See Also
Examples
## Not run:
# Ask a series of items at once in a dialog box
form <- list(
"Name:TXT" = "John Smith",
"Age:NUM" = 25,
"Sex:CB" = c("male", "female"),
"Married:CHK" = FALSE
)
dlg_form(form, "My data")$res
## End(Not run)