Rev 68948 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/utils/man/winMenus.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2018 R Core Team% Distributed under GPL 2 or later\name{winMenus}\title{User Menus under MS Windows (Rgui)}\alias{winMenuAdd}\alias{winMenuAddItem}\alias{winMenuDel}\alias{winMenuDelItem}\alias{winMenuNames}\alias{winMenuItems}\description{Enables users to add, delete and program menus for the \command{Rgui} in MS Windows.}\usage{winMenuAdd(menuname)winMenuAddItem(menuname, itemname, action)winMenuDel(menuname)winMenuDelItem(menuname, itemname)winMenuNames()winMenuItems(menuname)}\arguments{\item{menuname}{a character string naming a menu.}\item{itemname}{a character string naming a menu item on an existing menu.}\item{action}{a character string describing the action when that menuis selected, or \code{"enable"} or \code{"disable"}.}}\details{User menus are added to the right of existing menus, and items areadded at the bottom of the menu.By default the action character string is treated as \R input, beingechoed on the command line and parsed and executed as usual.If the \code{menuname} parameter of \code{winMenuAddItem} does notalready exist, it will be created automatically.Normally new submenus and menu items are added to the main consolemenu. They may be added elsewhere using the following special names:\describe{\item{\code{$ConsoleMain}}{The console menu (the default)}\item{\code{$ConsolePopup}}{The console popup menu}\item{\code{$Graph<n>Main}}{The menu for graphics window \code{<n>}}\item{\code{$Graph<n>Popup}}{The popup menu for graphics window\code{<n>}}}Specifying an existing item in \code{winMenuAddItem} enables theaction to be changed.Submenus can be specified by separating the elements in\code{menuname} by slashes: as a consequence menu names may notcontain slashes.If the \code{action} is specified as \code{"none"} no action is taken:this can be useful to reserve items for future expansion.The function \code{winMenuNames} can be used to find out what menushave been created by the user and returns a vector of the existingmenu names.The \code{winMenuItems} function will take the name of a menu andreturn the items that exist in that menu. The return value is a namedvector where the names correspond to the names of the items and thevalues of the vector are the corresponding actions.The \code{winMenuDel} function will delete a menu and all of its itemsand submenus. \code{winMenuDelItem} just deletes one menu item.The total path to an item (menu string plus item string) cannot exceed1000 bytes, and the menu string cannot exceed 500 bytes.}\value{\code{NULL}, invisibly. If an error occurs, an informative errormessage will be given.}\note{These functions are only available on Windows and only when usingthe \command{Rgui}, hence not in \command{ESS} nor \command{RStudio}.}\seealso{\code{\link{winDialog}}}\examples{\dontrun{winMenuAdd("Testit")winMenuAddItem("Testit", "one", "aaaa")winMenuAddItem("Testit", "two", "bbbb")winMenuAdd("Testit/extras")winMenuAddItem("Testit", "-", "")winMenuAddItem("Testit", "two", "disable")winMenuAddItem("Testit", "three", "cccc")winMenuAddItem("Testit/extras", "one more", "ddd")winMenuAddItem("Testit/extras", "and another", "eee")winMenuAdd("$ConsolePopup/Testit")winMenuAddItem("$ConsolePopup/Testit", "six", "fff")winMenuNames()winMenuItems("Testit")}}\keyword{utilities}