BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-22-2009, 10:52 PM   #1
jwir3
New Member
 
Join Date: Sep 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Posts: 2
Default Menu Position Change

Please Login to Remove!

Hi Everyone:

I've been trying to get the menu button to display a context menu in my application. I have multiple screens, and I have a ui class handling listening for key presses like so:

Code:
                else if (key == Keypad.KEY_MENU) 
                {
                    // menu key was pressed
                    Menu m = parent.getActiveScreen().getMenu(0);
                    m.show();
                }
Now, I also have the following, on a specific screen ("options" screen of my application):

Code:
    private MenuItem saveData = new MenuItem("Save", 110, 10) 
    {
        public void run() 
        {
            // perform saving functionality
        }
    };
    
    private MenuItem cancel = new MenuItem("Cancel", 110, 10)
    {
        public void run()
        {
            // cancel by popping the screen off the stack
            Screen currentScreen = getUiEngine().getActiveScreen();
            getUiEngine().popScreen(currentScreen);
        }
    };
        
    public OptionsMenu()
    {       
        // We set the title on the screen
        LabelField title = new LabelField("Application Options", LabelField.FIELD_HCENTER);
        setTitle(title);
         
        addMenuItem(saveData);
        addMenuItem(cancel);
    }
It works ok, but there are two problems: 1) The menu displays in the upper right corner of the screen, and I'd like it to display in the bottom left corner of the screen, like other BB applications, and 2) if I have the menu open, and press the menu key again, it opens another menu (I can't tell what it says, because it's rendered off screen). I'd like to disable this multiple menu situation.

Can someone give me some idea of what I'm doing wrong? I've tried searching google, as well as reading through API docs, but can't seem to find what I'm looking for.

Thanks in advance,

~Jwir3
Offline  
Old 09-23-2009, 04:19 AM   #2
pgoeol
Thumbs Must Hurt
 
Join Date: Sep 2009
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 75
Default

If u are using the menu.show() api, then the Menu will be rendered on the Right-Top corner only...
Menu can be shown at the Left-Bottom corner (depending upon the Device) only when the device handles the menu rendering... u can achieve it by using the makeMenu() method of the screen...
Offline  
Old 09-23-2009, 04:06 PM   #3
jwir3
New Member
 
Join Date: Sep 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Posts: 2
Default

Hi. Thanks for the reply.

So, what would be the proper way to call makeMenu() from within my keyDown method? Could I do something like this:

Code:
    else if (key == Keypad.KEY_MENU) 
                {
                    // menu key was pressed
                    Menu m = parent.getActiveScreen().getMenu(0);
                    parent.getActiveScreen().makeMenu(m,0);
                }
Or is there another way?

Thanks,

~Jwir3
Offline  
Old 09-24-2009, 02:15 AM   #4
pgoeol
Thumbs Must Hurt
 
Join Date: Sep 2009
Model: 8100
PIN: N/A
Carrier: Airtel
Posts: 75
Default

if you are using this method, then u r not supposed to take care of Menu rendering... leave it on BB device to do it for you... you just check for the Menu Key Event and if it is there then do not consume the key event.... BB platform itself call the makemenu() method to render the menu...
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Shifter Switch AT180916 for John Deere Backhoe Loader 300D 310D 310E 310SE 310G picture

Shifter Switch AT180916 for John Deere Backhoe Loader 300D 310D 310E 310SE 310G

$299.00



DCI FOOT SWITCH PEDAL 2 POSITION 1/PK. SELECT SPS # 9406 picture

DCI FOOT SWITCH PEDAL 2 POSITION 1/PK. SELECT SPS # 9406

$132.99



Dusk to Dawn Photocell Light Switch Auto ON Off Light Sensor Control Switch picture

Dusk to Dawn Photocell Light Switch Auto ON Off Light Sensor Control Switch

$55.88



1/8-1/2 INCH NPT ELECTRIC RADIATOR FAN THERMOSTAT TEMP-ERATURE SENSOR SWITCH KIT picture

1/8-1/2 INCH NPT ELECTRIC RADIATOR FAN THERMOSTAT TEMP-ERATURE SENSOR SWITCH KIT

$19.95



ELECTRIC COOLING FAN GROUND-ING THERMO-STAT SWITCH RADIATOR TEMP-ERATURE SENSOR picture

ELECTRIC COOLING FAN GROUND-ING THERMO-STAT SWITCH RADIATOR TEMP-ERATURE SENSOR

$19.95



40A Manual Transfer Switch Line-Off-Gen for (2)120V or (1)240V Device, UL Listed picture

40A Manual Transfer Switch Line-Off-Gen for (2)120V or (1)240V Device, UL Listed

$69.25







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.