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 contextMenuBehaviour .
A "provider" sets the property contextMenuId 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 Context Menus .
Example of the Visual Display
Display in the Application | Display in View Designer |
---|---|
|
|
Runtime Class |
CL_WD_CTX_MENU_PROVIDER |
Properties in the 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 associated higher-level classes. The associated UI elements are:
For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. Bear in mind the different spellings.
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 |