[R-gui] tcltk notebook question: Accessing tabs in ttknotebooks

Ulrike Grömping groemping at bht-berlin.de
Mon May 4 22:27:23 CEST 2009


Dear all,
(and John, please don't feel obliged to react, I know that you have no 
time!),
I am trying to figure out how to access individual tabs on a notebook. I 
have six tabs, created with the following simple code (where topdes2 is 
the top level window):

tn <- ttknotebook(topdes2)

tab1 <- ttkframe(tn)
tab2 <- ttkframe(tn)
tab3 <- ttkframe(tn)
tab4 <- ttkframe(tn)
tab5 <- ttkframe(tn)
tab6 <- ttkframe(tn)

tkadd(tn,tab1,text="Base Settings")   ### tabid=0
tkadd(tn,tab2,text="Factor Details")  ### tabid=1
tkadd(tn,tab3,text="Estimable Model") ### tabid=2
tkadd(tn,tab4,text="Block & Split-Plot") ### tabid=3
tkadd(tn,tab5,text="Special") ### tabid=4
tkadd(tn,tab6,text="Export") ### tabid=5

Now I want to disable or hide some tabs, if certain conditions are true. 
I've been able to conditionally disable all kinds of non-tab controls, 
but the tabs of the notebook so far resist my efforts. The TclTk help 
for ttk::notebook lists the widget command "pathname tab tabid ?-option 
?value ..." which I believe is the correct one, but I can't figure out 
how to make R transfer that command to tcl. I believe that the tabid 
values in the comments after tkadd are the correct ones for this 
command, but I'm not even sure about that. Everyting I've tried doesn't 
quite make sense to me, the last tries were along the lines of

.Tcl(tn, "tab", paste(4, "-state","disabled",sep=" " )),

after using .Tcl.args and other things failed. But no luck nowhere.

Any ideas ?

Regards, Ulrike



More information about the R-SIG-GUI mailing list