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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 22
Registered: ‎01-19-2009
My Device: Not Specified

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

 

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

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
Developer
Posts: 22
Registered: ‎01-19-2009
My Device: Not Specified

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

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
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
Developer
Posts: 293
Registered: ‎02-25-2009
My Device: Not Specified

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