You can use ShowActionMenuForCurrentInNesting in a ViewModel expression to display the standard action menu for the current object in a specified nesting; use it when a placingContainers layout means you handle selection and current-object behavior yourself.
When to use it
When you use placingContainers, you are responsible for selecting an object and making it current. This includes providing access to actions that would otherwise be reached through the generic user-interface behavior.
Call ShowActionMenuForCurrentInNesting after you have set the current object for the nesting. The operator opens the action menu at the location where the user invoked the expression. The menu gives the user access to actions that match the object's type and the user's access groups.
Syntax
selfVM.ShowActionMenuForCurrentInNesting('<nesting name>')
| Part | Meaning |
|---|---|
selfVM
|
The current ViewModel context. |
ShowActionMenuForCurrentInNesting
|
Shows the action menu for the current object in the named nesting. |
'<nesting name>'
|
The name of the nesting whose current object the menu should use. |
Example
The following expression makes self the current object in the Things nesting, then opens that nesting's action menu:
vCurrent_Things := self;
selfVM.ShowActionMenuForCurrentInNesting('Things')
In this example:
vCurrent_Things := selfsets the current object for theThingsnesting.ShowActionMenuForCurrentInNesting('Things')displays the actions available for that current object.
Requirements and behavior
- Set the appropriate
vCurrent_<nesting name>value before showing the menu. In the example, the nesting isThings, so the current value isvCurrent_Things. - Pass the nesting name exactly as it is defined in the ViewModel. In the example, both the current variable and the operator call use
Things. - The displayed menu is based on actions matched to the current object's type and the user's access groups.
- Use this operator to let the user choose an available action. If you need to run one known ViewModel action directly from OCL or EAL, use ExecuteAction instead.
ExecuteActionruns the named action without applying its visible or disabled expression, so you must enforce any required enable rules yourself.
