[R] tcltk scrollbar

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Oct 8 08:37:12 CEST 2007


kapo coulibaly wrote:
> The following code should give me (at least that's what I think) two list
> boxes with their individual scrollbars. But instead both scrollbars stick to
> the same listbox even though they work as they should (scroll individual
> listboxes). When I remove all the widgets on top everything works perfectly.
> Any help would be highly apprecciated.
> ps: all subsequent listboxes and scrollbars work perfectly, the first one
> (column 1 of main window) is the only one constantly off.
>
>   
Er,......

I just don't see it. What exactly goes wrong for you?

> library(tcltk)
> tt<-tktoplevel()
> mainFont<-tkfont.create(family="times",size=16)
> lbl.MainT<-tklabel(tt,text="Basic Manipulation",font=mainFont)
> tkgrid(lbl.MainT,sticky="nw")
> but.Browse<-tkbutton(tt,text=" Browse ",command=browse)
> but.Apply<-tkbutton(tt,text=" Apply ")
> scr1 <- tkscrollbar(tt,
> repeatinterval=5,command=function(...)tkyview(lsbDim1,...))
> scr2 <- tkscrollbar(tt,
> repeatinterval=5,command=function(...)tkyview(lsbDim2,...))
> lsbDim1<-tklistbox(tt,height=10,selectmode="multiple",yscrollcommand=function(...)tkset(scr1,...),background="white",exportselection=FALSE)
> lsbDim2<-tklistbox(tt,height=10,selectmode="multiple",yscrollcommand=function(...)tkset(scr2,...),background="white",exportselection=FALSE)
> for (i in 1:70) {
>     tkinsert(lsbDim1,"end",i)
>     }
> for (i in 1:70) {
>     tkinsert(lsbDim2,"end",i)
>     }
>
> tkgrid(lsbDim1,scr1,lsbDim2,scr2)
> tkgrid.configure(scr1,rowspan=10,sticky="nsw")
> tkgrid.configure(scr2,rowspan=10,sticky="nsw")
>   

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list