[R] checking for "viability" of a GUI component

From: Hao Liu <hao.liu_at_bms.com>
Date: Wed, 30 May 2007 14:45:01 -0400


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)
}

}

How do I check for existance of the GUI, instead of the variable?

Thanks



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 May 2007 - 18:56:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 May 2007 - 21:31:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.