Learn R Programming

svDialogs (version 0.9-52)

dlgForm: A flexible form dialog box

Description

Fill a form in a dialog box.

Usage

dlgForm(form, title = "Fill the form", message = NULL, columns = 1,
    strip.type = TRUE, ..., gui = .GUI)

## These should not be called directly
## S3 method for class 'gui':
dlgForm(form, title = "Fill the form", message = NULL, columns = 1,
    strip.type = TRUE, \dots, gui = .GUI)
## S3 method for class 'textCLI':
dlgForm(form, title = "Fill the form", message = NULL, columns = 1,
    strip.type = TRUE, \dots, gui = .GUI)
## S3 method for class 'nativeGUI':
dlgForm(form, title = "Fill the form", message = NULL, columns = 1,
    strip.type = TRUE, \dots, 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 tile of the dialog box.
message
an optional message to display in the dialog box. Use \n for line break, or provide a vector of character strings, one for each line.
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.

Value

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

concept

GUI API dialog boxes

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: :TXT for simple (default) textual box, :H for hidden text (password), :RO for read-only text, :NUM for null of positive integers with up/down arrows, :CHK for checkbox: TRUE or FALSE, :CB for read-only combobox, :CBE for editable combobox, :FL to select one existing file, :MFL to select multiple existing files, :SFL to select or create one file, :DIR to select a directory, :CDIR to select or create a directory, :FN to select font and font size, :DT to enter a date, :CLR to enter a RGB color, :BTN to create a button that execute some code, :LBL to add a label.

See Also

dlgInput

Examples

Run this code
## 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
)
dlgForm(Form, "My form")$res

Run the code above in your browser using DataLab