[R] tklistbox - R-Objekt

thoeb t.hoebinger at gmail.com
Sun Nov 23 20:18:00 CET 2008


Hello, I have a problem with a tklistbox. The user should be able to choose
one out of two calculation methods needed for further calculations. My
r-script for that purpose looks like that:

    require(tcltk)
    tt<-tktoplevel()
    tl<-tklistbox(tt,height=4,selectmode="single",background="white")
    tkgrid(tklabel(tt,text="select method for LAI calculation"))
    tkgrid(tl)
    method<- c("method1","method2")
    for (i in (1:2)){
        tkinsert(tl,"end",method[i])
        }
    tkselection.set(tl,0)
    OnOK <- function(){
    	choice<-method[as.numeric(tkcurselection(tl))+1]
           tkdestroy(tt)
            }
    OK.but <-tkbutton(tt,text="   OK   ",command=OnOK)
    tkbind(tkgrid, "<Return>",OnOK)
    tkgrid(OK.but)

The function works, but it does not create any r-object to that I can access
later on. How do I have to modify the function that I get an object with the
value "method1" or "method2"?

-----
Tamara Hoebinger
University of Vienna
-- 
View this message in context: http://www.nabble.com/tklistbox---R-Objekt-tp20649714p20649714.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list