Menus

This section summarizes the four menu types:

  • Application menu

  • Command menu

  • View menu

  • Submenu

The three menu types are structured like the widgets in the previous section. Each entry includes a brief description, repeating some of the information from Chapter 4, followed by an enumeration of the widget’s attribute and model properties, as well as relevant events. Unlike the other menu types, Submenu is accessed through a direct API, so the format for this entry will be structured as an API entry.

AppMenu

The Application menu appears in the upper-left corner of the screen when the user taps the left side of the status bar. It includes some system-defined and some application-defined actions, and is intended to have an application-wide scope for the most part.

Attribute properties

Type

Description

omitDefaultItems

Boolean

If true, default menu items will not be added to this menu

richTextEditItems

Boolean

If true, the Edit menu will also include Bold/Italics/Underline

Model properties

Type

Description

label

String

Currently not supported

visible

Boolean

Current visibility of this menu

Items

Object

Object containing items for this menu, structured as:

  label

String

User-visible label for this item, not rendered for groups

  icon

String

CSS class for icon to display in this item

  iconPath

String

Path to image to display in menu item, relative to application’s directory

  width

Integer

Calculated based on item’s width; specifies the width in pixels of this menu item; overrides default calculations; ignored for groups

  items

Boolean

If this is specified, this item is a group that visually ties the child items together

  toggleCmd

Boolean

Only used when items is specified; specify this property to make this group a toggle group; this string is the command of currently selected choice item in this group, and this property is modified by the widget when a different choice is made

  command

Boolean

Specify to make this item a choice; it will then respond to a user tap by sending a Mojo.Event.command through the commander chain with this string as the command property

  disabled

Boolean

Menu choice is disabled when this is true; only used for items that also specify command

  submenu

Boolean

Specify to make this item a submenu item; it will then respond to a user tap by displaying the named menu as a pop-up submenu

  template

String

Path to HTML template for custom content to be inserted instead of a standard menu item; the template is rendered using this item model object for property substitution

  checkEnabled

Boolean

If set to true, a Mojo.Event.commandEnable event will be sent through the commander chain each time this menu item is displayed or invoked via keyboard shortcut

Events

Mojo.Event.command
Mojo.Event.commandEnable

Command Menu

The Command menu items are presented at the bottom of the screen. Items include variable-sized buttons that can be combined into groups, and in a horizontal layout from left-to-right.

Attribute properties

Type

Description

spacerHeight

Boolean

If specified, the spacer DIV associated with this menu will be the given height in pixels

menuClass

Boolean

Alternate CSS style; default is palm-default

Model properties

Type

Description

label

String

Currently not supported

visible

Boolean

Current visibility of this menu

items

Object

Object containing items for this menu, structured as:

  label

String

User-visible label for this item, not rendered for groups

  icon

String

CSS class for icon to display in this item

  iconPath

String

Path to image to display in menu item, relative to application’s directory

  width

Integer

Calculated based on item’s width; specifies the width in pixels of this menu item; overrides default calculations; ignored for groups

  items

Boolean

If this is specified, this item is a group that visually ties the child items together

  toggleCmd

Boolean

Only used when items is specified; specify this property to make this group a toggle group; this string is the command of currently selected choice item in this group, and this property is modified by the widget when a different choice is made

  command

Boolean

Specify to make this item a choice; it will then respond to a user tap by sending a Mojo.Event.command through the commander chain with this string as the command property

  disabled

Boolean

Menu choice is disabled when this is true; only used for items which also specify command

  submenu

Boolean

Specify to make this item a submenu item; it will then respond to a user tap by displaying the named menu as a pop-up submenu

  template

String

Path to HTML template for custom content to be inserted instead of a standard menu item; the template is rendered using this item model object for property substitution

  checkEnabled

Boolean

If set to true, a Mojo.Event.commandEnable event will be sent through the commander chain each time this menu item is displayed or invoked via keyboard shortcut

Events

Mojo.Event.command
Mojo.Event.commandEnable

View Menu

The View menu presents items as variable-sized buttons, either singly or in groups across the top of the scene. The items are rendered in a horizontal sequence starting from the left of the screen to the right.

Attribute properties

Type

Description

spacerHeight

Boolean

If specified, the spacer DIV associated with this menu will be the given height in pixels

menuClass

Boolean

Alternate CSS style; default is palm-default

Model properties

Type

Description

label

String

Currently not supported

visible

Boolean

Current visibility of this menu

items

Object

Object containing items for this menu, structured as:

  label

String

User visible label for this item, not rendered for groups

  icon

String

CSS class for icon to display in this item

  iconPath

String

Path to image to display in menu item, relative to application’s directory

  width

Integer

Calculated based on item’s width; specifies the width in pixels of this menu item; overrides default calculations; ignored for groups

  items

Boolean

If this is specified, this item is a group that visually ties the child items together

  toggleCmd

Boolean

Only used when items is specified; specify this property to make this group a toggle group; this string is the command of currently selected choice item in this group, and this property is modified by the widget when a different choice is made

  command

Boolean

Specify to make this item a choice; it will then respond to a user tap by sending a Mojo.Event.command through the commander chain with this string as the command property

  disabled

Boolean

Menu choice is disabled when this is true; only used for items which also specify command

  submenu

Boolean

Specify to make this item a submenu item; it will then respond to a user tap by displaying the named menu as a pop-up submenu

  template

String

Path to HTML template for custom content to be inserted instead of a standard menu item; the template is rendered using this item model object for property substitution

  checkEnabled

Boolean

If set to true, a Mojo.Event.commandEnable event will be sent through the commander chain each time this menu item is displayed or invoked via keyboard shortcut

Events

Mojo.Event.command
Mojo.Event.commandEnable

Submenu

Mojo.Controller.SceneController.popupSubmenu()

Pop-up submenus can offer a transient list of choices to the user, typically off of another menu entry or from a DOM element in the scene.

Arguments

Type

Description

onChoose

Function

Called when user makes a choice and the pop-up is dismissed

placeNear

Element

Used to position the pop-up menu near the triggering element

toggleCmd

Boolean

Causes the appropriate item to appear with a checkmark; supported in top-level model for pop-ups

popupClass

String

CSS class for the pop-up menu, referenced from the HTML templates

scrimClass

String

CSS class for the pop-up scrim; defaults to submenu-popup

manualPlacement

Boolean

If true, pop-up menu will not be placed automatically (centered, or near placeNear element)

items

Array

Array of choices; each choice is an object with the following properties:

  label
StringDisplay name of choice
  command
StringCommand string passed to onChoose handler when selected
  secondaryIcon
StringCSS class for a secondary icon to display, generally used for some kind of status, and appearing to the left of the menu item
  secondaryIconPath
StringJust like iconPath, but for secondaryIcon
  chosen
BooleanStyles the item as the selected item in the group
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.41.179