2. Structuring an Application : How You Can Change Global Constants at Runtime : Selecting an Operation Style : How You Can Provide Multiple Invocation Styles
 
Share this page                  
How You Can Provide Multiple Invocation Styles
Providing multiple invocation styles does not require multiple blocks of code. For example, the following event block provides both a Close button and a Close menu operation (that can have an associated speed key):
on click close_button,
on click menu.file.close_menu =
{
     return;
}
Note:  You must refer to menu operations by their complete names. The syntax is:
MenuBar.MenuStack.MenuItem
MenuBar
Specifies the name of the menu bar. Menu bars are named “menu” by default when you create them in the Menu Editor, although you can rename a dynamically created menu bar whatever you want.
MenuStack
Refers to the operation name that appears on the menu bar, such as File or Options. Each operation that appears on the menu bar can have a stack of operations associated with it that appears when the user clicks the operation name. The operation that appears on the bar for the example stack is probably called File, as its variable name is "file."
MenuItem
Specifies the associated operation for this particular menu item—for example, the Open, Close, and Exit items on the File menu. The operation on the example stack affected by this event is the "close_menu" operation.