Conveniently manipulate Tk menus

Share:

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

1
2
3
4
5
6
7
8
9
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)

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?

expr

an expression to execute corresponding to the menu item call.

Details

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

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

Author(s)

Philippe Grosjean

See Also

menuAdd