Learn R Programming

svDialogs (version 0.9-57)

dlgList: A list selection dialog box

Description

Select one or several items in a list.

Usage

dlgList(choices, preselect = NULL, multiple = FALSE, title = NULL,
    …, gui = .GUI)
   
## These should not be called directly
# S3 method for gui
dlgList(choices, preselect = NULL, multiple = FALSE, title = NULL,
    …, gui = .GUI)
# S3 method for textCLI
dlgList(choices, preselect = NULL, multiple = FALSE, title = NULL,
    …, gui = .GUI)
# S3 method for nativeGUI
dlgList(choices, preselect = NULL, multiple = FALSE, title = NULL,
    …, gui = .GUI)

Arguments

choices

the list of items. It is coerced to character strings.

preselect

a list of preselections, or NULL (then, the first element is selected in the list). Preselections not in choices are tolerated (and disregarded, of course).

multiple

is it a multiple selection dialog box?

title

the title of the dialog box, or NULL.

pass further arguments to methods.

gui

the 'gui' object concerned by this dialog box.

Value

The modified 'gui' object is returned invisibly. A list with selected items, or a character vector of length 0 if the dialog box was cancelled is available from gui$res (see examples).

Examples

Run this code
# NOT RUN {
## Select a month
res <- dlgList(month.name, multiple = TRUE)$res
if (!length(res)) {
  cat("You cancelled the choice\n")
} else {
  cat("You selected:\n")
  print(res)
}
# }

Run the code above in your browser using DataLab