Creating Custom Context Menu Entries - Maple Help

 You can customize the entries and actions on a context menu module using the ContextMenu package commands.
 Note: On this help page, the custom context menu module is referenced by the name newCM.

Simple Entries

 The simplest context configuration that can be created is a single entry with a command.
 > newCM:-Entries:-Add( "Increment the integer", "%EXPR + 1", integer );
 This command adds a menu entry with the text label Increment the integer to the top-level context menu.
 The second argument, $"%EXPR + 1"$, is a string that indicates the action to be performed if the associated menu entry is selected. The text $"%EXPR"$ serves as a placeholder for the object that the user clicks, and will be replaced by the value of this object if the associated entry is selected. For example, if a user selects the Maple integer 5, and selects Increment the integer from the operations listed in Context Panel, the text 5 + 1 is inserted into the worksheet.
 The third argument, integer, specifies that this menu entry appears only when the object in focus is of type integer.

Entries with Help Strings

 You can optionally supply a help string for a menu entry.  A help string is text, usually slightly longer than the text of the menu entry, that describes the action performed.  It is displayed in a tooltip when the mouse pointer is positioned over the menu entry. For example:
 > newCM:-Entries:-Add( "Increment the integer", "%EXPR + 1", integer, helpstring="Increment the integer by 1" );

 When designing a menu system, it is recommended that you group together entries that are logically related, and impose a hierarchy on menu entries to avoid a single menu with an overwhelming number of entries. These two goals can be accomplished by using submenus and categories.

 A submenu is a context menu that is launched by clicking an entry in a context menu. Submenus are useful for grouping together a set of related entries.
 When adding an entry to the context menu module, you can specify that this entry be placed in a submenu by using the submenu option.