MenuItem

The MenuItem object represents a menu item for the screen.


Code Example:
<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>


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
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
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 IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.ui.menu" /> Y Y Y      Y

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

Properties

String caption
Boolean isDefault
Boolean isSeparator
Number ordinal

Properties

String caption


Contains the caption for the menu item.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

readonly Boolean isDefault


Value is true if the menu item is marked as the default item to be selected in the menu.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

readonly Boolean isSeparator


Value is true if the menu item is a separator.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

Number ordinal


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.


Supported Platforms
 - BlackBerry OS 5.0+
 - Ripple Emulator

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 11 2013 14:51:08 GMT-0500 (EST)