R can combine various windows (native, Tk, Gtk, etc.). There could be problems when a GUI uses various kinds of windows together. For instance, it is very difficult to define a modal window that is modal for the whole application. These functions manage windows and ease their clean creation and destruction.
winAdd(name = "win1", type = "tkWin", parent = .TkRoot, title = NULL,
pos = NULL, bind.delete = TRUE, …)
winDel(window)
winGet(window)
winNames()# S3 method for guiWin
print(x, …)
name for a new window
type of window to create. Currently, only Tk windows (\"tkWin\") are supported
parent of this window
title of the window
where to place the window. A string like '+XX+YY' where XX is the
horizontal position in pixels, and YY is the vertical position. Using
negative values place the window relative to the right or bottom side of the
screen. Specifying NULL
(by default) allows for automatic placement
of the window.
do we automatically bind winDel()
to the windows
delete event (strongly advised for correct housekeeping)?
additional options to pass to the window creator, or the print() method.
the name of a 'guiWin' object .
an object of class 'guiWin'.
winAdd()
and winGet()
return the handle to the window (invisibly
for winAdd()
.
winNames()
return the list of all windows registered in .guiWins.
winDel()
returns invisibly TRUE
if the window is found and
deleted, FALSE
otherwise.
The list of windows and pointers to their handles are stored in '.guiWins'
in the SciViews:TempEnv
environnement.
# NOT RUN {
## These cannot be run by examples() but should be OK when pasted
## into an interactive R session with the tcltk package loaded
## Creating and destroying a Tk window and inspecting the list
winNames()
winAdd("tt", title = "My win", pos ="-40+20")
winNames()
tkwm.deiconify(winGet("tt")) # Standard tcltk functions on the window
winDel("tt")
winNames()
# }
Run the code above in your browser using DataLab