Nearly all NShape Controller- and Presenter Components support context menus. The content of the context menu is created dynamically by collecting MenuItemDef objects from all objects that can be the target of a command, e.g. the diagram, the selected shapes and their respective model objects.
You can control the offered context menu items from the command targets (shapes, model objects, diagrams) themselves or from the user interface components.
a) | By changing the permissions of the users and the security domain of the shapes, context menu items can be disabled/eliminated.
See Programmer Tasks: Controlling User Access for details on how to restrict user permissions. |
As stated above, the GetMenuItemDefs method is available for most controller- and presenter components but also for templates, shapes and model objects.
For the Display component, the context menu item definitions are collected from the following components in the specified order:
1. | From IDiagramPresenter.ActiveTool.GetMenuItemDefs, if exactly one shape is selected: |
a. | From (selected) shape's Shape.Template.GetMenuItemDefs |
b. | From (selected) shape's Shape.GetMenuItemDefs |
c. | From (selected) shape's Shape.ModelObject.GetMenuItemDefs |
2. | From Display.GetMenuItemDefs |
See also
Programmer Tasks: Controlling User Access
Programmer Tasks: Customizing the Tool Box