07-30-2009 02:32 AM
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); } };
07-30-2009 02:36 AM
Check this thread.
07-30-2009 08:40 AM
12-23-2011 05:31 AM
Add this menu.setOrigin(0, Display.getHeight()); imidiate after adding menu items to menu.
12-23-2011 08:12 AM
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.
12-29-2011 11:07 AM
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).
12-29-2011 06:40 PM
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.