menuAdd(menuname)
menuAddItem(menuname, itemname, action)
menuDel(menuname)
menuDelItem(menuname, itemname)
menuNames()
menuItems(menuname)"none" for no action. Use "enable" or
"disable" to activate or desactivate an existing menu item.NULL invisibly. They are used for their
side-effect of creating, changing, or deleting custom R menus.winMenuAdd() and similar function do. Menus are added to the right
and new menu entries are added to the bottom of the menu. It is currently
not possible to add menus for Rterm.exe under Windows.
On Unix/Linux, under Gnome, you must install a little Gtk2 program called
ctxmenu, as well as a few other utilities to manage these
menus. You can download corresponding files (GPL-2 license) and instructions
from options(svDialogs.tmpfiles = TRUE)).
Once you installed these files, you can access the menus by setting up
keyboard shortcuts to activate main and context menus. The respective
commands are ctxmenu-main and ctxmenu-context
and you can use the preference panel to assign, e.g., "none". In this case, no action is
done when the menu item is selected (merely as a placeholder for future
menu actions). You can change the action of an existing menu by reissuing
the command with a different action argument.
If the menuname parameter of menuAddItem() does not exists, it is
automatically created. For creating submenus, separate successive menu
names with slashes. Use "-" as name for separation menus under
Windows or Unix/Linux.dlgForm## Add a menu and two entries
menuAdd("Test")
menuAddItem("Test", "List objects", "ls()")
menuAddItem("Test", "List search paths", "search()")
## Add a submenu implicitly
menuAddItem("Test/Submenu", "Current working dir", "setwd()")
## Remove Test menu and submenus
menuDel("Test")Run the code above in your browser using DataLab