NShape Programmer Tasks
Customizing Context Menus

<< Click to Display Table of Contents >>

Navigation:  Programmer Tasks >

NShape Programmer Tasks
Customizing Context Menus

Previous pageReturn to chapter overviewNext page

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.
b)By hiding or showing menu items that cannot be executed due to missing permissions.
See "Hiding Unauthorized Menu Items".
c)By extending built-in context menus with additional global items.
See "Extending Built-In Context Menus".
d)By extending custom context menus with NShape commands.
See "Integrate NShape Commands in your Own Context Menus".
e)By modifying the shape implementation or by deriving your own shapes you can modify the GetMenuItemDefs functions and return other menu item definitions.
See "Developing a New Shape: Define Shape Specific Commands".

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