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


Thread Tools

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


Mitsubishi Control Board DM00N649.  SM76A127G02 . Ductless unit 47-0910KR (C64) picture

Mitsubishi Control Board DM00N649. SM76A127G02 . Ductless unit 47-0910KR (C64)

$120.00



Jelenko Commodore LS VPF with Pump  picture

Jelenko Commodore LS VPF with Pump

$875.00



Windsor Commodore Fastraction Carpet Cleaner CMD picture

Windsor Commodore Fastraction Carpet Cleaner CMD

$1995.00



Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC picture

Vintage Printer Switch box Commodore 64/Sanyo Mountable Computer PC

$49.00



One CSG 6526A Input/Output Clock Chip For Commodore Dip-40 IC picture

One CSG 6526A Input/Output Clock Chip For Commodore Dip-40 IC

$39.99



2 SIEMENS 1X 3RB2283-4AA1, 1X 3RB2906-2BG1 . C64 picture

2 SIEMENS 1X 3RB2283-4AA1, 1X 3RB2906-2BG1 . C64

$212.04







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