Dear list members,
I would like to combine two list boxes with tcltk. The source code runs fine - but when I choose in the upper box an item, the selected item in the lower box disappears and vice versa. Could anybody help me?
This is the source code:
############## require(tcltk)
choose.variables<-tktoplevel()
choose.group<-tklistbox(choose.variables,height=4,selectmode="single",background="white")
tkgrid(tklabel(choose.variables,text="Select group variable"))
tkgrid(choose.group)
all.variables1 <- c("group1","group2","group3","group4")for (i in (1:4))
{tkinsert(choose.group,"end",all.variables1[i])}
tkselection.set(choose.group,0)choose.endpoint<-tklistbox(choose.variables,height=4,selectmode="single",background="white")
tkgrid(tklabel(choose.variables,text="Select endpoint variable"))
tkgrid(choose.endpoint)
all.variables2 <- c("endpoint1","endpoint2","endpoint3","endpoint4")for (j in (1:4))
{tkinsert(choose.endpoint,0,all.variables2[j])}
tkselection.set(choose.endpoint,0)OnOK <- function()
{groupChoice <- all.variables1[as.numeric(tkcurselection(choose.group))+1]
endpointChoice <- all.variables2[as.numeric(tkcurselection(choose.endpoint))+1]
tkdestroy(choose.variables)
msg <- c(groupChoice, endpointChoice)
tkmessageBox(message=msg)}
OK.but <-tkbutton(choose.variables,text=" OK ",command=OnOK) tkgrid(OK.but) tkfocus(choose.variables)
##############
Thanks in advance, Cornelia
****************************************************** Dipl.Ing.agr. Cornelia Froemke Lehrgebiet Bioinformatik Fachbereich Gartenbau Universitaet Hannover Herrenhaeuser Str. 2 D-30419 Hannover
Tel.: 0511 762-5821 mailto:[EMAIL PROTECTED]
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
