# NOT RUN {
## window with handler
win <- gwindow("Window example",
handler=function(h,...) {
print("See ya")
})
gbutton("cancel", container=win,
handler = function(h,...) dispose(win))
## block closing of window
win <- gwindow("Window example")
addHandlerUnrealize(win, handler = function(h,...) {
val <- gconfirm("Really close window", parent=h$obj)
if(as.logical(val))
return(FALSE) # destroy
else
return(TRUE) # don't destroy
})
## transient dialog (gWidgetsRGtk2)
pwin <- gwindow("Parent window")
cwin <- gwindow("Child window", parent = pwin)
## clicking button close parent causing child to close too
gbutton("close both", container=cwin,
handler = function(h,...) dispose(pwin))
# }
Run the code above in your browser using DataLab