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

Posts: 41
Registered: ‎09-26-2008
My Device: Not Specified

How to show different Menus for MenuKey and NavigationClick

I have extended both the RichTextField class and the FullScreen class in my Project. Both classes have a collection of MenuItems. I have overriden the makeMenu method in the Fullscreen Class and the RichTextField Class:



protected void makeMenu(Menu menu, int instance) { if (m_ContextMenuItems != null) { for (int i = 0; i < m_ContextMenuItems.length; i++) { menu.add(m_ContextMenuItems[i]); } } }


This works just fine to some extent. Whenever an unhandled Trackball click is executed or the menu key is pressed, a menu appears that contains both the menu items of the screen and of the field.


What I'm trying to do now is showing the menu items of the field when the Trackball is clicked, and the menu items of the screen when the menu key is pressed. 


Is there a way to tell in the makeMenu method of the screen if the method was called because of the menu key or the trackball click? If not, how else could this be achieved?


I'm working with the Eclipse Plugin and the 4.3 component pack. 


Thanks for the time. 


BlackBerry Development Advisor
Posts: 15,809
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How to show different Menus for MenuKey and NavigationClick

Yes there is.  Please see the following link.


How To - Distinguish between a full menu and a primary actions menu
Article Number: DB-00565


Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.