MenuItem
The MenuItem object represents a menu item for the screen.
| 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
| API | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
|---|---|---|---|---|---|
| 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 ID | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
|---|---|---|---|---|---|
| <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. |
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)