[R] tcl/tk bind destroy event

Franco Mendolia franco.mendolia at gmx.de
Thu Aug 3 14:25:03 CEST 2006


> I don't think that is it. As I read it, Tk catches the Destroy event
> alright, but the problem is that it is too late: the window
> destruction is already in motion at the time and there's no way to
> "undestroy" it from within binding. I think you need to create a "wm
> protocol" handler for WM_DELETE_WINDOW. As in
>  
> x <- tktoplevel()
> tcl("wm", "protocol", x, "WM_DELETE_WINDOW", quote(cat("I'm staying!\n")))
> 
> --- now try to destroy the window using window controls ---
> 
> tcl("wm", "protocol", x, "WM_DELETE_WINDOW", "")
> 
> --- things should be back to normal now ---

Yeah! That's it! Thanks!



More information about the R-help mailing list