MenuItem

The MenuItem object represents a menu item for the screen.

Learning Resources:

Sample - Menu Items Example that demonstrates how to use the Menu API to create a custom application menu in a BlackBerry WebWorks application [BlackBerry Developer Resource Center].

Supported Platform(s)

- BlackBerry OS 5.0+
- Ripple Emulator

View Supported Platform Table

APIOS 5.0OS 6.0OS 7.0PlayBookRipple
caption Y Y Y  Y
isDefault Y Y Y  Y
isSeparator Y Y Y  Y
ordinal Y Y Y  Y

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:


You must declare the feature element(s) below in your configuration document:

Feature IDOS 5.0OS 6.0OS 7.0PlayBookRipple
<feature id="blackberry.ui.menu" /> Y Y Y  Y

Permission Elements (PlayBook Only)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

API Summary


Properties:


Property Type Description Supported Platform(s)
caption String Contains the caption for the menu item.
 - BlackBerry OS 5.0+
 - Ripple Emulator
isDefault Boolean
readonly
Value is true if the menu item is marked as the default item to be selected in the menu.
 - BlackBerry OS 5.0+
 - Ripple Emulator
isSeparator Boolean
readonly
Value is true if the menu item is a separator.
 - BlackBerry OS 5.0+
 - Ripple Emulator
ordinal Number Each MenuItem has an ordinal specifying the sort order within the menu. MenuItems with a lower ordinal will have higher positions on the menu than the MenuItems with higher ordinal. A separator will be automatically inserted between adjacent items whose ordinals differ by at least 0x00010000.
 - BlackBerry OS 5.0+
 - Ripple Emulator

Code Example(s)


<script type="text/javascript">
  
  function clickMe() {
     alert("user just clicked me");
  }
  
  var item = new blackberry.ui.menu.MenuItem(false, 1, "Hello World", clickMe);
  blackberry.ui.menu.addMenuItem(item);
  
</script>

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 13:31:18 GMT-0500 (EST)