[R] How to disable existing menus in tcltk?

Jarno Tuimala jtuimala at csc.fi
Mon Jan 22 09:57:59 CET 2007


Hi!

I've constructed a small menu-driven interface to a couple of R functions 
using the possibilities offered by the tcltk package. When user runs some 
specific analyses, I would then like to disable some of the menus (or menu 
choises) that are not applicable after the performed analysis. I tried to 
modify the state of an existing menu, but it seems that neither 
tkconfigure nor tkentryconfigure contains the state as one of its options.

Here's a snip of the code. How could I disable, for example, the Edit 
data menu choise after already creating the menu (I want it to be active 
initially)?

gui<-tktoplevel()
topMenu<-tkmenu(gui)
tkconfigure(gui,menu=topMenu)
editMenu<-tkmenu(topMenu, tearoff=FALSE)
tkadd(editMenu, "command", label="Edit data", command=function() editData())
tkadd(editMenu, "command", label="Preferences", command=function() editPref())
tkadd(topMenu, "cascade", label="Edit", menu=editMenu)

Thanks,
Jarno Tuimala



More information about the R-help mailing list