You use global actions to create entries in the application’s top-level Main Menu, including actions that open ViewModels such as seekers and browsers. This page is for MDriven Designer users who want to add, organize, and maintain those menu actions.
What global actions are
A global action is an action available from the Global Menu (the rendered Main Menu). It is not tied to a particular object or to one ViewModel location.
A common global action opens an un-rooted ViewModel:
- A seeker helps the user search or filter a large set of objects before working with one of them.
- A browser shows the available instances of a class.
For example, a global action named PersonSeeker can bring up the PersonSeeker ViewModel from the Main Menu. The user can then find a Person and continue in another view.
Global actions are one of the action types in MDriven. They appear only in the Global Menu. Class actions are available for objects of a particular class, and ViewModel actions are available only in the ViewModel where they are defined. For the broader action model and action behavior, see Documentation:Actions and Documentation:Application actions.
Open the Global Actions editor
- In MDriven Designer, open the model diagram.
- Click the cog-wheels toolbar button.
- In the Global Actions window, use the list on the left to select an existing global action.
The right side shows the definition of the selected action and a rendered preview of the current Main Menu. Selecting an action in the rendered menu selects its definition in the editor. Selecting the ViewModel icon beside a rendered action opens the ViewModel Editor for the ViewModel that action brings up.
Keep this window large enough to show its action buttons. A small window can hide controls such as Ensure Std Actions and the delete button.
Create a Main Menu action
Create a global action when users need to open a ViewModel from the Main Menu.
- Open the Global Actions editor.
- Select Add Global Action.
- Enter an ActionName. Use a name that tells the user what the action opens or does. For example,
PersonSeeker. - Under What the action does, set Bring Up View Model to the ViewModel to open. For example, select
PersonSeeker. - Set MenuGroup if the action belongs in a menu or submenu. Leave it empty to place the action at the top level of the Main Menu.
- Save the model.
- Run or refresh the application and select the menu action to verify that it opens the intended ViewModel.
Use the three-dot button beside Bring Up View Model to locate the selected ViewModel in the ViewModel Editor. This is useful when checking that an action points to the intended seeker or browser.
MenuGroup controls where the global action appears in the Main Menu.
- Leave MenuGroup empty to show the action at the top level.
- Set MenuGroup to a group name to place the action under that group.
- Use
/to define nested menu levels.
For example, set MenuGroup to IControlTheMenuGrouping/AtAllLevels. The Main Menu contains IControlTheMenuGrouping, with AtAllLevels beneath it, and the action appears in that submenu.
To create a group, select the three-dot button beside MenuGroup, select Add menu group, enter the group path, and close the dialog. A global action is shown in one menu location only: after you assign a MenuGroup, it no longer appears at the top level.
Use DividerGroupWithinMenu to divide actions in the same menu into sections.
For example, if PersonSeekerAgain has DividerGroupWithinMenu SomeName and PersonSeekerIAmInControl has no divider group, the menu displays a separation between them. If both actions use SomeName, they belong to the same section and that separation is removed.
Set action order
Use Sort order in group to control the order of actions within their menu group.
For example:
| Action | MenuGroup | Sort order in group | Result |
|---|---|---|---|
PersonSeekerIAmInControl
|
IControlTheMenuGrouping/AtAllLevels
|
AAA
|
Appears before the action with BBB.
|
PersonSeekerAgain
|
IControlTheMenuGrouping/AtAllLevels
|
BBB
|
Appears after the action with AAA.
|
Change the sort-order values, save, and refresh the running application to confirm the rendered order.
Standard global actions
The Global Actions editor can restore the default standard actions. Select Ensure Std Actions to create any of these actions that are missing:
| Action | Purpose |
|---|---|
| Save | Saves changes in the current view. |
| Cancel | Cancels changes in the current view. |
| Refresh | Refreshes data from the server. |
| Undo | Reverses changes in the current view. |
| Redo | Reapplies changes that Undo reversed. It has no effect until Undo has been used. |
| Exit | Exits the application when the execution environment supports it, such as WPF. |
Web applications do not normally use Exit, and may not use every standard action in the same way as a Windows application. Do not rely on an action being present because it was deleted earlier; use Ensure Std Actions when you need to restore the defaults. For details, see Documentation:Standard actions.
This example creates two global actions that open the same seeker and controls their grouping and order.
- Create a global action named
PersonSeekerIAmInControl. - Set Bring Up View Model to
PersonSeeker. - Create the MenuGroup
IControlTheMenuGrouping/AtAllLevelsand assign it to the action. - Create a second global action named
PersonSeekerAgain. - Set its Bring Up View Model to
PersonSeekerand assign the same MenuGroup. - Set Sort order in group to
AAAon the action that should appear first andBBBon the other action. - Save and refresh the running application.
Both entries now appear next to each other under the same nested menu. If you set different DividerGroupWithinMenu values, they appear in separate menu sections. If you swap AAA and BBB, their menu order swaps after saving and refreshing.
Related action configuration
A global action can open a ViewModel, but actions can also perform other configured behavior. See Training:What an Action can do for the available action behavior.
As a model grows, control which class and ViewModel actions appear in each view instead of using global actions for object-specific operations. See Training:Available Actions and Documentation:Turnkey session 3: Opting out actions.
