Form menus
FormMenuDefinition, item kinds and built in commands.
In this documentation
- Beep.Forms
- Architecture
- Authoring in the Object Navigator
- WinForms runtime
- WPF runtime
- End-to-end example
- Remote UI limitations
- Overview
- Context menus
- Blocks and items
- Triggers
- Lists of values
- Validation
- Master detail
- Navigation and queries
- Alerts, editors and timers
- Calling other forms
- Form menus
- Hosting in WinForms step by step
- Hosting in WPF step by step
- Saving and loading forms
- The IDE toolbar and dialogs
- Troubleshooting
A menu is a FormMenuDefinition with FormName and Items. Each FormMenuItem has Id, Label, Shortcut, Kind, CommandName, BlockName and Children.
FormMenuItemKind is BuiltIn, MenuItemTrigger, CallForm, Separator or Submenu.
Built in commands
Names are not case sensitive.
| CommandName | Action |
|---|---|
| ExecuteQuery | Run the query |
| EnterQuery | Enter query mode |
| Commit, CommitForm | Commit |
| Rollback, RollbackForm | Rollback |
| ClearForm | CloseFormAsync |
| NextRecord, PreviousRecord, FirstRecord, LastRecord | Record navigation |
| CreateRecord, InsertRecord | New record |
| DeleteRecord | Delete record |
| ExitForm | CloseFormAsync |
Any other name gives the error "Menu item command 'x' is not a known built-in."
Running and reading menus
IFormMenuManager has RegisterMenu, GetMenu, FindItem and the event MenuChanged. InvokeMenuItemAsync(itemId) runs an item. An unknown id gives "No menu item 'id' is registered." A MenuItemTrigger item fires the WhenMenuItem trigger.
In the WinForms host
FormDefinition.Menu is the design time menu. The WinForms host draws it in a BeepMenuBar exposed as MenuBar, and RefreshMenu() redraws it. MergeMenuIntoShell, UnmergeMenuFromShell and FormMenuShellAdapter support merging into a shell menu.