BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
jwir3 Offline
New Member
 
Posts: 2
Join Date: Sep 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Default Menu Position Change - 09-22-2009, 11:52 PM

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
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
pgoeol Offline
Knows Where the Search Button Is
 
Posts: 39
Join Date: Sep 2009
Model: 8100
PIN: N/A
Carrier: Airtel
Default 09-23-2009, 05:19 AM

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...
   
Reply With Quote
  (#3 (permalink)) Old
jwir3 Offline
New Member
 
Posts: 2
Join Date: Sep 2009
Model: 8330
PIN: N/A
Carrier: Sprint
Default 09-23-2009, 05:06 PM

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
   
Reply With Quote
  (#4 (permalink)) Old
pgoeol Offline
Knows Where the Search Button Is
 
Posts: 39
Join Date: Sep 2009
Model: 8100
PIN: N/A
Carrier: Airtel
Default 09-24-2009, 03:15 AM

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...
   
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.