[R] combined list boxes / tcltk

John Fox jfox at mcmaster.ca
Fri Dec 17 14:48:04 CET 2004


Dear Cornelia,

Add the argument  exportselection=FALSE  to tklistbox().

I hope this hleps,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Cornelia Froemke
> Sent: Friday, December 17, 2004 4:57 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] combined list boxes / tcltk
> 
> 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,selectmod
> e="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:froemke at bioinf.uni-hannover.de
> 
> ______________________________________________
> 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




More information about the R-help mailing list