Popup submenus can be used to provide a text list of choices to the user. It accepts standard menu models with a few additional optional properties.
Example usage:
sceneController.popupSubmenu(this.controller, {
onChoose:this.popupChoose,
placeNear:clickEvent.target,
items: [{label: $L('Apply'), command: 'apply-cmd'},
{label: $L('Applique'), command: 'applique-cmd'},
{label: $L('Applaud'), command: 'applaud-cmd'},
{label: $L('Approximate'), command: 'approx-cmd'}]
});
The above code will cause a modal list to appear with the label choices presented. When the user taps one, the onChoose function will be called in the scope of the scene assistant with the command property of the chosen item. If the user taps outside the popup menu, the menu is dismissed and the onChoose function is called with undefined.
Beyond the standard menu model properties, the submenu supports some additional model properties:
Property | Type | Description |
---|---|---|
onChoose | Function | Called when the user makes a choice from the menu |
placeNear | Element | Used to position the submenu near a specified element (optional) |
toggleCmd | Causes appropriate item to appear with a checkmark. Supported in top-level popup model. (optional) | |
popupClass | String | CSS class for popup menu (optional) |
scrimClass | String | CSS class for popup scrim. Defaults to submenu-popup. (optional) |
manualPlacement | Boolean | True to prevent popup from being placed automatically (centered or near specified placeNear element) |
Beyond the standard menu item properties, the submenu supports some additional menu item properties:
Argument | Type | Description |
---|---|---|
secondaryIcon | String | CSS class for a secondary icon to be displayed. Usually used for displaying status. Appears to the left of the menu item. (optional) |
secondaryIconPath | String | Like iconPath, but for secondaryIcon (optional) |
chosen | Boolean | Causes item to be styled as selected item in a toggle group (optional) |
Keyboard shortcuts can be displayed in the submenu, but are implemented by the main menu system.
0 Comments