menuPick | ||||||||||
Type | message | |||||||||
Dictionary | LCS | |||||||||
Library | LiveCode Script | |||||||||
Syntax |
| |||||||||
Associations | button | |||||||||
Summary | Sent to a button when a menu item is chosen from the menu associated with that button. | |||||||||
Introduced | 1.0 | |||||||||
Changes | In version 3.5 menu tags were added to the menu item specification. | |||||||||
OS | mac, windows, linux, ios, android | |||||||||
Platforms | desktop, server, mobile | |||||||||
Parameters |
| |||||||||
Example |
| |||||||||
Related | Keyword: character, menu, button Property: label, menuName, menuHistory Command: pulldown Object: button Glossary: property, tabbed button, menu item, handler, message, menu, button menu, parameter | |||||||||
Description | Handle the menuPick message to do something when the user chooses a menu item from a button menu, or chooses a tab in a tabbed button.
The menuPick message is sent when the user clicks a tab in a tabbed button, when the user chooses a menu item from the menu associated with a button, or when a button's menuHistory property is set by a handler. The menuPick message is sent every time a menu item is chosen, even if the menu is a type that retains its state (such as an option menu) and the chosen menu item has not changed. (However, no menuPick message is sent when an already-chosen tab in a tabbedbutton is clicked, since no menu is displayed.) To get the item number of the currently chosen menu item, use the menuHistory property.
The menu item specification allows a tag to be specified using the form:
Note that the tag is optional as is the accelerator however, if you want an item with a tag but without the accelerator you need:
If a menu item has a tag then it is the tag string that is passed to menuPick rather than the label. This is useful for localization of menu items as you don't need to change the menuPick handler for each language supported. The following tags should be used to label the standard edit menu items to enable them to be controlled by the system dialogs on Mac OS X (e.g. answer file, ask file etc.):
| |||||||||
Tags | menus |