These functions provide an easy way to create and manipulate Tk menus
under R. Note that the corresponding menuXXX()
function also manipulate
Tk menus the same way, but are capable of manipulating other menus as well.
One should, thus, preferably use menuXXX()
!
tkMenuAdd(menu, tearoff = FALSE)
tkMenuAddItem(menu, item, action, image = "", accel = "", options = "")
tkMenuDel(menu)
tkMenuDelItem(menu, item)
tkMenuItems(menu)
tkMenuChangeItem(menu, item, action = "", options = "")
tkMenuStateItem(menu, item, active = TRUE)
tkMenuInvoke(menu, item)
tkMenuItemCall(expr)
name of a menu.
should the menu be detachable?
name of a menu item.
action the menu triggers (R code).
name of an image to display at left of the menu item.
accelerator (keystroke) to use to trigger this menu item.
additional options, for instance 'state = "disable"' to disable the menu at creation.
do we enable or disable the menu item?
an expression to execute corresponding to the menu item call.
tkMenuAdd()
and tkMenuAddItem()
return the handle of the newly
created menu/menu item invisibly.
tkMenuDel()
and tkMenuDelItem()
return invisibly TRUE
if
the resource is found and deleted, FALSE
otherwise.
tkMenuItems()
returns the list of all items in a given menu.
tkMenuInvoke()
returns invisibly TRUE
if the menu item was
invoked, FALSE
otherwise.
tkMenuStateItem()
returns the new state of the menu.
tkMenuItemCall()
is usually not called directly by the end-user, but
rather through a menu. It is a user-visible function so that it is possible
to substitute it with a custom function to manage menu item calls
differently in a custom GUI, for instance.
Do not use these functions directly. Prefer the corresponding menuXXX()
functions that will call them if Tk menus or menu items are provided.