Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
sunwebsite
Posts: 43
Registered: ‎09-09-2011
My Device: 9900
My Carrier: airtel
Accepted Solution

I want to modify menu items from blackberry menu key

In my blackberry application I want to clear the existing menu item option of( Swith Application, Close, Select), and add new menu options to the menu key.


I tried the below code but nothing is happening for me.

 

if (blackberry.ui.menu.getMenuItems().length > 0) {    
      blackberry.ui.menu.clearMenuItems();     
    }    
    var item = new blackberry.ui.menu.MenuItem(false, 1, "Click Me", customMenuItemClick);
    blackberry.ui.menu.addMenuItem(item);
    
    function customMenuItemClick() {
      alert("user just clicked me");
    }

 I inserted  <feature id="blackberry.ui.menu" required="true" version="1.0.0.0" />? into config.xml file
 but no use.

 

How do I modify the menu items 

Please use plain text.
Regular Contributor
genvej
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

Re: I want to modify menu items from blackberry menu key

The search buttons will do you wonders ;-)

 

Anywayz, this link helped me greatly

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Adding-Menu-Items-using-the-Blac...

Please use plain text.
Contributor
sunwebsite
Posts: 43
Registered: ‎09-09-2011
My Device: 9900
My Carrier: airtel

Re: I want to modify menu items from blackberry menu key

Thanks genvej. It works for me. 

But, 

blackberry.ui.menu.clearMenuItems()

did not remove my default menu items like Switch Application, Select, Close

 

can you tell me how do i remove that?

Please use plain text.
Regular Contributor
genvej
Posts: 58
Registered: ‎01-19-2011
My Device: 9800
My Carrier: vodafone

Re: I want to modify menu items from blackberry menu key

I would consider removing those as bad UI practice. They appear (as far as I know) in every menu in all apps.

 

If you use the order functionality combined with seperators I think you will find it ok?

 

I dont know how to remove those default items (havent searched either ;-) ) 

Please use plain text.
Trusted Contributor
zahirw
Posts: 134
Registered: ‎04-15-2012
My Device: Bold 9900
My Carrier: Vodafone

Re: I want to modify menu items from blackberry menu key

Even if you can't remove the default items ie. Select, Switch & close, can we atleast rearrange them into the menu in an order that is more suited?

Eg.

About
--------
Login
Select
--------
Logout
Close
Switch application

Thanks
Please use plain text.
Trusted Contributor
zahirw
Posts: 134
Registered: ‎04-15-2012
My Device: Bold 9900
My Carrier: Vodafone

Re: I want to modify menu items from blackberry menu key

Any word on this?
Please use plain text.