Learn R Programming

svWidgets (version 0.9-40)

tkMenu: Conveniently manipulate Tk menus

Description

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()!

Usage

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)

Arguments

menu
Name of a menu
tearoff
Should the menu be detachable?
item
Name of a menu item
action
Action the menu triggers (R code)
image
Name of an image to display at left of the menu item
accel
Accelerator (keystroke) to use to trigger this menu item
options
Additional options, for instance 'state = "disable"' to disable the menu at creation.
active
Do we enable or disable the menu item?

Value

  • 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.

Details

Do not use these functions directly. Prefer the corresponding MenuXXX() functions that will call them if Tk menus or menu items are provided.

See Also

MenuAdd