Skip to content
Prev 920 / 1236 Next

[R-gui] tcltk: change the parent of a widget

Dear R-SIG-GUI list readers,

If I have two canvas objects (canvas1 and canvas2), both containing 
items and event bindings:

tt <- tktoplevel()
canvas1 <- tkcanvas(tt, ...)
canvas2 <- tkcanvas(tt, ...)
## ... tkcreate(...); tkitembind(...); ...

and I'd like to display either one canvas in the toplevel window tt, or 
display both, canvas1 and canvas2, in two different toplevel windows 
(say, tt and tt1).

Is there a way to pack canvas1 or canvas2 into another toplevel window 
than the tt window (for which it was defined)? It's important that all 
event bindings stay preserved.

Sincerely,

Adrian Waddell