[R] checking for "viability" of a GUI component
Hao Liu
hao.liu at bms.com
Wed May 30 20:45:01 CEST 2007
Dear All:
The question: How do I check for existance of the GUI, instead of
checking the variable of the GUI?
I created a log window for several applications, they will check for the
existance of log window, if it exists, append output to it, otherwise,
create log window and insert to it. What I found out is that if I close
the X window of the GUI, the variable logwin still exists, confuse
arises to other components that are supposed to use the GUI.
create.log.win <- function(inputtext){
if(exists(is.null("logwin"))) {return} else {
logwin <<- tktoplevel()
logtext <<- tktext(logwin, bg="white")
tkwm.title(logwin," Log Window")
loglabel <- tklabel(logwin, text="Logging Analaysis Information")
tkgrid(loglabel)
tkgrid(logtext)
if (is.matrix(inputtext)) {
for (i in 1:nrow(inputtext))
tkinsert(logtext, "end",paste(paste(inputtext[i,],collapse="
"),"\n",sep=""))
}
else tkinsert(logtext, "end",paste(inputtext,"\n",sep=""))
export_button <- tkbutton(logwin, text = "Export Log",
command=savelog)
tkgrid(export_button)
}
}
-- I understand I should bind a function to remove the varialbe with a
close button, however, we can't stop users from closing window just by
clicking on the upper right corner.
How do I check for existance of the GUI, instead of the variable?
Thanks
More information about the R-help
mailing list