Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Creating Custom Context Menu Entries
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, , is a string that indicates the action to be performed if the associated menu entry is selected. The text 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 right-clicks (for Macintosh, Control-clicks) the Maple integer 5, and selects Increment the integer from the context menu, the text 5 + 1 is inserted into the worksheet.
The third argument, integer, specifies that this menu entry appears only when the object that the user right-clicks (for Macintosh, Control-clicks) 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" );
Submenus and Categories
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.
Submenus
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.
newCM:-Entries:-Add( "To String", "convert(%EXPR, string)", Not(string), submenu=["Conversions"] );
The To String entry is placed on the Conversions submenu within the context menu system. For more information, see ContextMenu[CurrentContext][Entries][Add].
Categories
You can group together related entries in the top-level context menu without placing the groupings in separate submenus. This can be achieved using categories.
When adding an entry to a context menu module, you can specify a category by using a Maple string. Entries in the top-level context menu that have identical categories are grouped together in the menu. A horizontal divider is drawn between entries of different categories.
Note: The category name is not displayed in the context menu.
Important: Categories can be used only in top-level menu entries, not submenu entries.
newCM:-Entries:-Add( "Factor Integer", "ifactor(%EXPR)", integer, category="Integers" ); newCM:-Entries:-Add( "Test Primality", "isprime(%EXPR)", integer, category="Integers" ); newCM:-Entries:-Add( "Floor", "floor(%EXPR)", {float, fraction}, category="Non-Integers" );
The Factor Integer and Test Primality entries are grouped together in the top-level menu, with a dividing line separating them from the Floor entry.
Additional Information
For more information on customizing the context menus, see ContextMenu[CurrentContext].
See Also
Appending Actions to the Context Menu System, ContextMenu, ContextMenu Example Worksheet, ContextMenu[CurrentContext], ContextMenu[Install], ContextMenu[New], ContextMenu[Test], Creating a Context Menu System, Overview of Creating Context Menus
Download Help Document