Creating Graphical User Interfaces |
Defining Context Menus
Context menus are displayed when users right-click on the object for which the menu is defined. The Menu Editor enables you to define context menus and associate them with objects in the layout.
Creating the Parent Menu
All items in a context menu are children of a menu that is not displayed on the figure menubar. To define the parent menu, select New Context Menu from the Menu Editor's toolbar.
Select the menu and specify the Tag
to identify the context menu (axes_context_menu
in this example).
Adding Items to the Context Menu
Create the items that will appear in the context menu using New Menu Item on the Menu Editor's toolbar.
When you select the menu item, the Menu Editor displays text fields for you to enter the menu Label
and Tag
properties.
Associating the Context Menu with an Object
Select the object in the Layout Editor for which you are defining the context menu. Use the Property Inspector to set this object's UIContextMenu
property to the desired context menu.
Add a callback routine subfunction to the GUI M-file for each item in the context menu. This callback executes when users select the particular context menu item. See The Menu Callback for information on defining the syntax.
Menu Callbacks | Setting the Tab Order - The Tab Order Editor |