
R/tk2swaplist.R
tk2swaplist.RdThe swaplist is perfect to select and arrange items in a given order from a fixed initial set of possible items.
tk2swaplist(items, selection, title = "Select items", ...)A vector with all items.
A vector with preselected items (must be a subset of items).
The title of the dialog box, by default, "Select items".
Further parameters passed to swaplist, see its tcl man page: https://core.tcl-lang.org/tklib/doc/trunk/embedded/www/tklib/files/modules/swaplist/swaplist.html.
A vector with the selected items in the chosen order.
if (FALSE) { # \dontrun{
library(tcltk2)
# tk2swaplist() makes its use super-easy
tk2swaplist(1:9, selection = c(1, 3, 5))
# Use of the swaplist on your own
tclRequire("swaplist")
tt <- tktoplevel()
opts <- tclVar()
sl <- tcl("swaplist::swaplist", tt, opts, 1:9, c(1, 3, 5))
cat("You choose:", tclvalue(opts), "\n")
rm(opts, sl, tt)
} # }