Skip to content

[R-gui] seeking R tcltk solution

2 messages · morphwj@comcast.net, John Fox

#
Dear Bill,

Yes, it's possible to do this, but a little tricky, since you need to save
the "ID" and "position" of the menu item so that you can then address it. I
do menu activation/deactivation in the Rcmdr package using this function:

activateMenus <- function(){
    for (item in getRcmdr("Menus")){
        if (item$activation()) .Tcl(paste(item$ID, " entryconfigure ",
item$position - 1," -state normal", sep=""))
        else .Tcl(paste(item$ID, " entryconfigure ", item$position - 1,"
-state disabled", sep=""))
        }
    }

What's of direct interest to you, I think, is the first call to .Tcl for
enabling a menu item (where item$ID is the item ID and item$position, which
I previously saved).

If you'd like a bit more context, see as well the function Commander() in
the file Commander.R in the source for the Rcmdr package, and in particular
near line 600.

I hope this helps,
 John

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