dialogUtils {rNMR} | R Documentation |
The functions detailed below display custom Tk dialogs in rNMR. Several of these functions replace Windows-specific functions available in Rgui for cross-platform use.
buttonDlg(message, buttons, checkBox = FALSE, default = buttons[1], title = 'rNMR', parent = NULL) err(message, parent = NULL, halt = TRUE) myDialog(message, default, title = 'rNMR', entryWidth = 20, parent = NULL) myDir(initialdir = "", parent = NULL, title = "", mustexist = TRUE) myMsg(message = "", type = "ok", icon = "question", title = "rNMR", parent = NULL) myOpen(defaultextension = "", filetypes = "", initialfile = "", initialdir = "", multiple = TRUE, title = "", parent = NULL) mySave(defaultextension = "", filetypes = "", initialfile = "", initialdir = "", title = "", parent = NULL) mySelect(list, preselect = NULL, multiple = FALSE, title = NULL, index = FALSE, parent = NULL)
message |
character string; message to display in the Tk dialog. |
buttons |
character string or vector; names for the buttons to display. If "Apply to all" is provided as the third option, a checbox will be displayed in the GUI with that label. |
default |
( |
checkBox |
logical; if |
title |
character string; title for the dialog. |
parent |
optional Tk toplevel object to set as a parent window for the newly created dialog. If provided, the dialog will appear near its parent and will bring the parent toplevel object to the front. This is particularly useful for displaying message or error dialogs in response to user interactions within rNMR GUIs. |
halt |
logical; stops code execution if |
default |
( |
entryWidth |
numeric; width of the text entry box in characters. |
initialdir |
character string; default directory path. |
title |
character string; title for the Tk dialog. |
mustexist |
logical; if |
type |
character string; the type of buttons to display in the dialog, must be one of "abortretryignore", "ok", "retrycancel", "okcancel", "yesno", or "yesnocancel". |
icon |
character string; icon to use in the dialog, must be one of "error", "info", "question" or "warning". |
defaultextension |
( |
filetypes |
adds the provided file types to the file types listbox in the open dialog if supported by the platform. Must be in list format, for example: list(txt = "Text File", xls = "Excel File") |
initialfile |
character string; specifies a filename to be displayed initially in the dialog. |
multiple |
logical; if |
defaultextension |
( |
list |
character string or vector; items to display in the list box. |
preselect |
character string or vector; items to be preselected in the list box. |
index |
logical; if |
buttonDlg
Displays a dialog with a message and buttons. If
checkBox
is set to TRUE
, the last button will be a checkbox
with a label containing the last item in buttons
. With this option
enabled, the text associated with the button pressed to close the dialog will
be returned along with either TRUE
or FALSE
to indicate whether
or not the checkbox was checked when the button was pressed. This is useful
when confirming multiple file overwrites.
err
Displays an error dialog and halts command execution.
myDialog
A Tk version of R's winDialogString
;
displays a dialog box with a text entry widget.
myDir
A Tk version of R's choose.dir
; displays a
directory selection dialog.
myMsg
Displays a dialog with customizable buttons, icon, and message.
myOpen
and mySave
Display file open and save dialogs, respectively.
mySelect
A Tk version of R's select.list
; displays
a list selection dialog.
buttonDlg
, err
, and myMsg
return the text associated
with the button pressed to close the dialog. If checkBox
is set to
TRUE
in buttonDlg
, the return value will be a data.frame with
two values, the first being the button text, the second a logical value
indicating whether or not the dialog's checkbox was checked when the user
pressed one of the buttons. myDir
, myOpen
, and mySave
return the selected file or directory name. mySelect
returns the
selected list items as a character vector.
Ian A. Lewis ialewis@nmrfam.wisc.edu, Seth C. Schommer schommer@nmrfam.wisc.edu
toolkit
for other rNMR utility functions.