If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified

menu does not appear when menu button is pressed

When I click on the menu button (left of the trackball),

my menu does not appear.

 

See  http://www.flickr.com/photos/36330828545@N01/3364785322/ 

 

But if I press the trackball, the menu appears.

 

See http://www.flickr.com/photos/36330828545@N01/3363960913/

 

FYI,

a) my screen extends from FullScreen

b) I have overridden the method makeMenu.

c) The screen is constructed with styles

 

 Screen.DEFAULT_MENU | Screen.DEFAULT_CLOSE

 

Thanks

 

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

Re: menu does not appear when menu button is pressed

what is the code of your make menu method?
----------------------------------------------------------
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
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified

Re: menu does not appear when menu button is pressed

[ Edited ]

Here's the code for my Screen:

 

 

protected void makeMenu( Menu menu, int instance )

{

super.makeMenu(menu, instance);

menu.add( menuSwitch );

}

 

private MenuItem menuSwitch = new MenuItem( "Switch Application", 100, 100 )

{

public void run()

{

UiApplication.getUiApplication().requestBackground();

}

}

 

 Thanks.

 

 

Message Edited by gibli on 03-18-2009 04:52 AM
Please use plain text.
Developer
simon_hain
Posts: 15,893
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: menu does not appear when menu button is pressed

add your menu items before the call to super (which shows the menu) and your custom item should be visible.
this may also be helpful:
http://www.slashdev.ca/2008/05/07/menuitem-demystified/
----------------------------------------------------------
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
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified

Re: menu does not appear when menu button is pressed

Simon, 

 

Thanks for the answer. Close but no cigar.

 

Pressing the INSERT key on my PC keyboard should activate the Full Menu (left justified) but nothing happens.

 

But what i've learnt:

 

a) The menu system is dynamic, every press on the trackball will call makeMenu.

b) When the short form menu appears (as a result of trackball presses), the context is 65526. For the full menu, the context passed to makeMenu is 0.

 

Question: In a custom screen (that extends FullScreen), with a TextField and several labels, do I need to override makeMenu() for every widget on the screen? i.e. override for the Screen, VerticalFieldManager, BasicEditField etc.. What takes precedence ? Seems kind of clunky.

 

Regards,

 

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: menu does not appear when menu button is pressed

Overriding makeMenu in the screen should suffice.  This link explains how to differentiate between a full and reduced menu.

 

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

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: menu does not appear when menu button is pressed

If you subclass FullScreen (instead of MainScreen) then you will have to trap the menu key and call makeMenu() yourself.

/** * MENU key handler */ private void onMenu() { Menu menu = new Menu(); makeMenu( menu, 0 ); menu.show(); } protected boolean keyControl(char character, int status, int time) { switch (character){ // menu key pressed case Characters.CONTROL_MENU: onMenu(); return true; } return false; }

 

Please use plain text.
Developer
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified

Re: menu does not appear when menu button is pressed

@RexDoug,

 

Thanks for the tip. I solved my problem by creating a new project & subclassing Screen instead.

 

In this instance, I didn't need do anything special (like what you proposed). 

 

Nonetheless, this is good to know.

 

Please use plain text.
Regular Contributor
ScorchedIcee
Posts: 62
Registered: ‎07-21-2010
My Device: Bold 9900
My Carrier: Bell

Re: menu does not appear when menu button is pressed

I am experiencing this problem in a application I am developing ONLY on the device.  I have tried everything, even your suggestion to force it through code to open up the menu.

 

No matter what I do I cannot get the menu to show.  I have stepped through it in debug mode, and every single line of code is executed, not a single error at all.

 

If it is relevent, I also handle touchEvents, and click events.

 

I am pulling my hair out trying to figure out a solution, somebody help please :smileysad:

Please use plain text.