These functions are components used to build interactive interfaces.
tk.file
is a wrapper to tcltk functions tkgetOpenFile
and tkgetOpenFile
with several enhancements.
tk.files
proposes to build and order a file list from multiple calls to tk.file
.
tk.folder
is a wrapper to tcltk function tkchooseDirectory
with small enhancements.
handle
is a wrapper to withRestarts
, which allows to catch errors, warnings and messages while executing an R expression and handle them with custom functions.
tk.file(title = "Choose a file", typeNames = "All files", typeExt = "*",
multiple = FALSE, mandatory = TRUE, type = c("open", "save"), initialdir = NULL,
parent = NULL)
tk.files(preselection = character(0), multiple = TRUE, parent = NULL, ...)
tk.folder(title = "Choose a directory", mustexist = TRUE, mandatory = TRUE)
handle(expr, messageHandler, warningHandler, errorHandler)
tk.file
, tk.files
and tk.folder
return the selection as a character vector, possibly empty.
handle
returns nothing.
Single character value, the displayed name of the summoned window.
Character vector defining the displayed names of the filtered file extensions. Parallel to typeExt
.
Character vector defining the filtered file extensions (use "*" as wildcard). Parallel to typeNames
.
Single logical value, whether to allow multiple file selection or not.
Single logical value, whether to throw an error if no file is selected or not.
Single character value defining the label of the button.
Single character value, the initially selected directory when the window is summoned. NULL
corresponds to the last directory browsed via one of these functions.
A Tcl-Tk object to consider as the parent of the new frame.
Character vector, the files already selected when the window is summoned.
Further arguments to be passed to tk.file
.
Single logical value, whether to throw an error if a non-existing directory is selected or not.
An R expression in which errors, warnings and messages are to be caught. Use {}
to monitor a multi-line R code.
A function taking as single argument the condition object caught. If missing, messages will pass through.
A function taking as single argument the condition object caught. If missing, warnings will pass through.
A function taking as single argument the condition object caught. If missing, errors will pass through.
Sylvain Mareschal
tk.browse
, tk.convert
, tk.tracks