Arbortext Command Language > Using the Arbortext Command Language > Shortcut Menus
  
Shortcut Menus
You can create custom shortcut (popup) menus.
A shortcut menu is specified by using a colon as the first character of the menu path instead of a period.
To define a shortcut menu, specify : as the destination argument on the menu_add command. For example, this defines an abbreviated Edit menu, which could be posted in the Command window:
menu_add -menu : cmd -title "Command"
menu_add :cmd. Cut -cmd {delete_mark;} -key control-x
menu_add :cmd. Copy -cmd {copy_mark;} -key control-c
menu_add :cmd. Paste -cmd {paste;} -key control-g
menu_add :cmd. Delete -cmd {delete_mark null;}
* 
While the -title option is accepted, the title is not displayed at the top of shortcut menus.
The menu_load command may also be used to define shortcut menus. A shortcut menu is defined in the same way as a button menu, except the top-level definition for the shortcut menu is written using PopupMenu instead of Menu. A shortcut menu may not be referenced inside a Buttons section of the menu.cf file.
A user-defined shortcut menu is posted using the menu_popup function. The menu command posts the built-in menu for the current window. You need to map a key combination or mouse button to the function so users can access the menu. For example:
map m2 menu_popup("cmd")
where cmd is the name of a shortcut menu previously defined by a menu_load or menu_add command (as shown in the example above). The mapping could also be to a function that decides to post one of several shortcut menus based on the current position of the cursor or mouse.
A shortcut menu may be posted in any window. However, for performance reasons, it is often better to define a separate shortcut menu for each window. If a menu is posted in a different window than where it was last displayed, the window system objects in the previous window have to be destroyed and recreated in the new window.
The names of the built-in menus for the various window classes are shown in the table.
Built-in Menus For Window Classes
Menu name:
Class:
:EditPopup
edit
:Helpwin
help
:Workspace
helpwin[2-4], msgwin[1-4]
Related Topics
Modifying the default menus
Menu paths
Special characters in menu paths