[R] WinMenu's question

Ross Darnell r.darnell at uq.edu.au
Wed Jun 2 01:56:08 CEST 2004


I am using the Windows menu functions below which will work on the
first pass, but if I repeat the same script I cannot get the
WinMenuAddItem to work. This is a problem if I change the menu
structure and reread the source code I am forced to quit and restart Rgui.

"try.menu" <- function(){
  OS <- .Platform$OS.type
  GUI <- .Platform$GUI
  if (!(OS == "windows" & GUI == "Rgui")) return("Sorry, you must be running R using Rgui.exe on MS Windows")
  try(winMenuDelItem('EMG/Graphics','Plot.trace'))
  try(winMenuDel('EMG/Graphics'))
  try(winMenuDel("EMG"))
  winMenuAdd("EMG")
  winMenuAdd("EMG/Graphics")
  winMenuAddItem("EMG/Graphics","Plot trace","plot.trace()")
}
"plot.trace" <- function(){
  x <- eval(parse(text=trace.dialog()))
  plot(x,type="l")
  invisible()
}


Help much appreciated

Ross Darnell
-- 
University of Queensland, Brisbane QLD 4067 AUSTRALIA
Email: <r.darnell at uq.edu.au>
Phone: +61 7 3365 6087     Fax: +61 7 3365 4754
http://www.shrs.uq.edu.au/shrs/school_staff/ross_darnell.html




More information about the R-help mailing list