tk_select.list {utilitiesR}R Documentation

Function almost identical to tcltk::tk_select.list

Description

This function is identical to tcltk::tk_select.list, *except* that it adds in an additional tkwait.visibility to the code prior to calling tkgrab.set.

Usage

  tk_select.list(choices, preselect = NULL,
    multiple = FALSE, title = NULL, mono = FALSE)

Arguments

choices

a character vector of items.

preselect

a character vector, or NULL. If non-null and if the string(s) appear in the list, the item(s) are selected initially.

multiple

logical: can more than one item be selected?

title

optional character string for window title, or NULL for no title.

mono

whether to try display in monospace font (uses tcltk interface).

Details

This gets around the problem that sometimes occurs (on Linux? Unable to reliably reproduce), where one uses tcltk::tk_select.list, and gets the error [tcl] grab failed: window not viewable.

A bit of googling into tcltk suggests that this occurs when one attempts to set grab on a window that is not yet mapped to the screen (i.e. visible).

The solution is to add a tkwait.visibility(dlg) *before* calling tkgrab.set(dlg). That is what this function does.

See Also

Other ui: dir.browse, file.browse, Filters, gui.dir.choose, gui.file.choose, gui.menu, gui.readline, gui.yesno, tk_entry.dialog


[Package utilitiesR version 2.0 Index]