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
New Developer
sj_incognito
Posts: 9
Registered: ‎07-08-2009
My Device: Not Specified

Menu getting displayed on top right corner

I am using screen which extends FullScreen.

I have taken instance of Menu & added MenuItems in it in the method makeMenu() which I have overridden.

 

My problem is that, the Menu is being displayed on top-right corner of the screen.

I want it to be displayed on bottom-left corner. Can anyone please help?

 

Here is the piece of code related to the menu which i have used in the screen class :

private Menu myMenu; public MyScreen() { myMenu = new Menu(); } public boolean onMenu(int instance) { makeMenu(myMenu, instance); return super.onMenu(instance); } public void makeMenu(Menu menu, int instance) { System.out.println(menu+":::"+instance); menu.add( menuItem1 ); menu.add( menuItem2 ); menu.add( menuItem3 ); menu.show(); } ///////////////////////////////////////////////////////////////////////////////////////// private MenuItem menuItem1 = new MenuItem("menuItem1", 0, 1) { public void run() {} }; private MenuItem menuItem2 = new MenuItem("menuItem2", 1, 1) { public void run() {} }; private MenuItem menuItem3 = new MenuItem("Close", 2, 1) { public void run() { System.exit(0); } };

 

 

 

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Menu getting displayed on top right corner

Check this thread.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=45862&query.id=93...


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Menu getting displayed on top right corner

I know with the 4.7 JDE there is a function in the menu class called setOrigin that will allow you to move the menu, but it will not allow you to place the menu completely at the bottom of the screen (there is about a 30px gap). This function is undocumented, so use at your own risk. Otherwise you will have to make a custom Menu class to make it draw where you want.
Please use plain text.
Contributor
Piya15
Posts: 45
Registered: ‎11-29-2011
My Device: Blackberry Torch 9800,Blackberry Curve 9300

Re: Menu getting displayed on top right corner

Add this  menu.setOrigin(0, Display.getHeight());    imidiate after adding menu items to menu.

Please use plain text.
Developer
silver20
Posts: 455
Registered: ‎03-04-2011
My Device: Paper cup

Re: Menu getting displayed on top right corner

AFAIK only the MainScreen menu displays lower-left automatically, the others are theme-controlled and the OS6 theme shows it top-right.  If you try it on OS5 it will probably show lower-left.

 

You can use MainScreen instead of FullScreen, and get rid of the title by doing setTitle((Field)(new NullField()))

 

makes everything so much easier, you'll have default menu, default close, etc.

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: Menu getting displayed on top right corner

Agree.

 

No need to use this to get rid of the Title:

setTitle((Field)(new NullField()))

 

Just don't use setTitle() at all (which you probably don't since you have extended FullScreen).

 

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Menu getting displayed on top right corner

Hi,

 

Try this:

 

public void makeMenu(Menu menu, int instance)
{
super.makeMenu(menu, instance);
 System.out.println(menu+":::"+instance); menu.add( menuItem1 ); menu.add( menuItem2 ); menu.add( menuItem3 ); //menu.show(); }

You can also omit the onMenu function.

 

E.

 

 

 

Please use plain text.