1

I am trying to make a calculator for nokia 501 asha and i want all my buttons to fit on the the screen so that i don't have to scroll the form to access all buttons.

Apparently adding commands like exit,about and help are mandatory to your app.

Now when i add these commands one of the commands appear as a button and occupy a lot of screen space which i don't want.

I want my commands to appear like this i.e all commands on the slide context menu.

how i want my commands to appear

But instead there's an unnecessary button on the screen.

what I get

The code that i have used to add commands is as follows:

           Form a = new Form("form");
           a.addCommand(new Command("exit"),0);

           a.addCommand(new Command("HELP"),1);
           a.addCommand(new Command("ABOUT"),2);
           a.setEnabled(true);
                   a.show();

So, what modifications i need to make in that code so that all my commands appear on the slide context menu ?

Mun0n
  • 4,438
  • 4
  • 28
  • 46
user2497398
  • 61
  • 1
  • 1
  • 4

2 Answers2

0

I am looking the Asha UI Component Demos, in the Menu section, options menu. I find this code to add the Commands:

// The rest appear in menu
        Command menuCommand1 = new Command("Command 2", Command.SCREEN, 1);
        addCommand(menuCommand1);
        Command menuCommand2 = new Command("Command 3", Command.SCREEN, 2);
        addCommand(menuCommand2);
        Command menuCommand3 = new Command("Command 4", Command.SCREEN, 3);
        addCommand(menuCommand3);

Try to put this Command.SCREEN parameter.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • Command.SCREEN gives an error i am using lwuit to make my apps – user2497398 Jul 02 '13 at 18:01
  • I know that you are using LWUIT. Can you take a look on this project? https://projects.developer.nokia.com/asha_ui_component_demos , in this url you can download the project see the code, see the libraries that it has imported and you can see an example of how add the commands to the Menu. – Mun0n Jul 02 '13 at 18:59
0

This answer will help to someone. The following code is working in 501.

 protected void startApp() throws MIDletStateChangeException {
    // TODO Auto-generated method stub

    Display.init(this);

    // For hide the form title bar. It is working in Nokia asha 501.
    Display.getInstance().setForceFullScreen(true);
    Display.setObjectTrait(Display.getInstance().getImplementation(), "nokia.ui.canvas.status_zone", Boolean.TRUE);


    Form a = new Form("form");
    a.addCommand(new Command("exit"),0);

    a.addCommand(new Command("HELP"),1);
    a.addCommand(new Command("ABOUT"),2);
    a.setEnabled(true);
    a.show();

}
Thirumalvalavan
  • 2,660
  • 1
  • 30
  • 32