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

Java Development

Reply
Developer
Angel007
Posts: 22
Registered: ‎01-19-2009

How to remove only one item of the ContextMenu from a MainScreen?

Hi!, someone knows how to remove a ShowKeyboard/HideKeyboard menu items of the MainScreen?. I need to catch the event click on the ShowKeyboard/HideKeyboard menu items and then Show or Hide an HorizontalFieldManager in the screen, but I can't catch this event, so I can make my custom ShowKeyboard/HideKeyboard menu item and within this method I can Show or Hide the HorizontalFieldManager.

 

I want to remove only this item menu and show the Switch application and Close menu items, but if I initialize my MainScreen with the NO_SYSTEM_MENU_ITEMS parameter, it removes the SwitchApplication menu item.

 

Angel

 

Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008

Re: How to remove only one item of the ContextMenu from a MainScreen?

Hi,

 

You can delete a specific menu item from menu by calling delete(index) method on menu object.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
Angel007
Posts: 22
Registered: ‎01-19-2009

Re: How to remove only one item of the ContextMenu from a MainScreen?

Hi Rajat!

 

I can't delete that item as you said, because this is a item of ContextMenu not from Menu. This item change automatically, i.e. when the VirtualKeyboard is on screen, the item display "Hide Keyboard", and when the VirtualKeyboard is not on screen the item on the menu display "Show Keyboard". If I write: menu.delete(index -> (index = any number), this delete one of my custom menu item and I want to delete only this ContextMenu item.

 

Thanks for your help, Rajat.

 

Angel

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How to remove only one item of the ContextMenu from a MainScreen?

contextmenu has no delete(index) method. you can retrieve the menu items with getItems() (not listed in the API, use at your own risk) and add only the ones you want to have.
you can find the items by setting the locale to 'en' and comparing the menu item title (set the locale back afterwards).
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
amardeepjaiman
Posts: 293
Registered: ‎02-25-2009

Re: How to remove only one item of the ContextMenu from a MainScreen?

Hi,

 

If you are using FullScreen, you can override makemenu() to add or delte item from context menu.

 

 

~Amardeep

Please use plain text.