Menu
The Menu object contains functionality for manipulating menu items for the application.
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 |
API | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
---|---|---|---|---|---|---|---|
blackberry.ui.menu.addMenuItem | Y | Y | Y | Y | |||
blackberry.ui.menu.clearMenuItems | Y | Y | Y | Y | |||
blackberry.ui.menu.getMenuItems | Y | Y | Y | Y | |||
blackberry.ui.menu.hasMenuItem | Y | Y | Y | Y | |||
blackberry.ui.menu.open | Y | Y | Y | Y | |||
blackberry.ui.menu.removeMenuItem | Y | Y | Y | Y | |||
blackberry.ui.menu.setDefaultMenuItem | 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 | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
---|---|---|---|---|---|---|---|
<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. |
Functions
static
void
blackberry.ui.menu.addMenuItem
(item : blackberry.ui.menu.MenuItem)
Adds the supplied menu item to the menu.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
Parameters | |
---|---|
item | The menu item to add. |
Code Example:
|
static
void
blackberry.ui.menu.clearMenuItems
()
Removes all menu items from the current menu.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
static
blackberry.ui.menu.MenuItem[]
blackberry.ui.menu.getMenuItems
()
This method will return an array representing the menu items for the screen.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
static
Boolean
blackberry.ui.menu.hasMenuItem
(item : blackberry.ui.menu.MenuItem)
determine whether the menu contains the specified MenuItem.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
Parameters | |
---|---|
item | The menu item to be checked. |
static
void
blackberry.ui.menu.open
()
Opens the current screen's menu.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
static
void
blackberry.ui.menu.removeMenuItem
(item : blackberry.ui.menu.MenuItem)
Removes the specified menu item from the menu.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
Parameters | |
---|---|
item | The menu item to remove. |
static
void
blackberry.ui.menu.setDefaultMenuItem
(item : blackberry.ui.menu.MenuItem)
Sets which item on the menu should be selected by default.
Supported Platforms | |
---|---|
- BlackBerry OS 5.0+ | |
- Ripple Emulator |
Parameters | |
---|---|
item | The menu item to set as the default. |
Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 18:15:40 GMT-0500 (EST)