You can create a custom menu for a plot and associate one or more IMLPlus statements with each item on the menu. Such a menu is referred to as an action menu. To display a plot's action menu, press F11 while the plot's window is active. Choosing an item on the menu executes the IMLPlus statements associated with that item.
You can create a cascading menu by embedding newline characters (\n) in the menu text string. For example:
"Cascade\nMenu Item"J
Each newline character results in a new cascading menu. Note that the J suffix after the closing double quotation mark informs IMLPlus that it should process the string for embedded special characters. Normally, IMLPlus treats text strings literally.
To define a shortcut key for a menu item, type an ampersand (&) before a character in the item's text. For example, if you define the menu item "&My Item", you can choose that menu item by pressing the "m" key when the menu is displayed. Make sure all the shortcut keys on a menu are unique.
The IMLPlus statements associated with a menu item can contain string literals. To include a string literal, enclose the literal in either single or double quotation marks. If you use double quotation marks, prefix each quotation mark with a backslash (\) and place a J suffix after the string. For example, to print the word "Hello", you could use any of the following:
sCode = "print 'Hello';"; sCode = 'print "Hello";'; sCode = "print \"Hello\";"J;
If the IMLPlus program has finished running when an action menu item is invoked, the statements associated with the menu item are executed in the program’s main environment. Therefore, the statements can use any variables that are global in scope. If the program is paused when an action menu item is invoked, the statements are executed in the environment of the PAUSE statement. The statements can use any variables that are in the scope of the PAUSE statement. Typically, one writes action menu items to execute in the scope of the main program.
You can append menu items and menu separators to an action menu. You can bullet, check, enable, and disable existing menu items. You can remove menu items, and you can create cascading menus of arbitrary depth.
The list below summarizes the methods associated with managing action menus.
AppendActionMenuItem
Appends a new item to the end of the action menu.
AppendActionMenuItemToGroup
Appends a new item to the end of the group that contains an existing action menu item.
AppendActionMenuSeparator
Appends a new menu separator to the action menu.
AppendActionMenuSeparatorToGroup
Appends a new menu separator to the end of the group that contains an existing action menu item.
BulletActionMenuItem
Places a bullet (•) to the left of an item on the action menu.
CheckActionMenuItem
Controls whether an item on the action menu is flagged with a check mark.
EnableActionMenuItem
Enables or disables an item on the action menu.
InsertActionMenuItem
Inserts a new menu item after an existing item on the action menu.
InsertActionMenuSeparator
Inserts a new menu separator after an existing item on the action menu.
IsExistingActionMenuItem
Determines whether a particular item exists on the action menu.
RemoveActionMenuItem
Removes an item from the action menu.
ReplaceActionMenuItem
Replaces the text and code associated with an item on the action menu.
ReplaceActionMenuItemCode
Replaces the code associated with an item on the action menu.
ReplaceActionMenuItemText
Replaces the text associated with an item on the action menu.