
The ContextMenuProvider allows applications to create their own context menus. The context menus are always defined on a view. To allow this, entry CONTEXT_MENUS is always available for each view, together with the ROOTUIELEMENTCONTAINER. Here, you can define your required context menu at runtime.
This menu is assigned to view elements as follows. Each view element has three options:
These three cases are expressed in the property ContextMenuProvider Properties.
A "provider" sets property ContextMenuProvider Properties to the ID of its menu. To do this you need these two new properties in each (potential) provider. A provider can be:
Each UI element subclass is now automatically a (potential) provider. For the relevant view element subclasses the inheritance hierarchy has been changed so that it inherits from the ContextMenuProvider instead of from the ViewElement.
The ContextMenuProvider is used for the static definition of context menus. To create context menus dynamically, methods WDONCONTEXTMENU and F_WD_CONTEXT_MENU_MANAGER (context menu manager) are provided. See also: Dynamic and Static Context Menus
Example of the Visual Display
| Display in the Application | Display in View Designer |
|---|---|
|
|
| Runtime Class | CL_WD_CTX_MENU_PROVIDER |
Properties in View Designer
| Name | Type | Initial Value | Bindable |
|---|---|---|---|
STRING |
(automatic) |
No |
|
WDUI_CONTEXT_MENU_BEHAVIOUR |
inherit |
No |
|
STRING |
No |
Other properties that can be inherited are defined in the related higher-level classes. The associated UI element is ViewElement.
For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. But note that the spelling format and use of upper/lower case is different.
Dynamic Programming of Properties
| View Designer Name | Runtime Name | Type |
|---|---|---|
CONTEXT_MENU_BEHAVIOUR |
WDUI_CONTEXT_MENU_BEHAVIOUR |
|
contextMenuBehaviour: inherit |
CL_WD_CTX_MENU_PROVIDER=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT |
|
contextMenuBehaviour: provide |
CL_WD_CTX_MENU_PROVIDER=>E_CONTEXT_MENU_BEHAVIOUR-PROVIDE |
|
contextMenuBehaviour: suppress |
CL_WD_CTX_MENU_PROVIDER=>E_CONTEXT_MENU_BEHAVIOUR-SUPPRESS |
|
CONTEXT_MENU_ID |
STRING |