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


GE Voltage Stabilizer 10 KVA Transformer Pri 175-235/190-260/380-520 Sec 120/240 picture

GE Voltage Stabilizer 10 KVA Transformer Pri 175-235/190-260/380-520 Sec 120/240

$648.00



PHENIX TECHNOLOGIES HIGH VOLTAGE DIVIDER PHE001SC3 FOR Kilovoltmeters picture

PHENIX TECHNOLOGIES HIGH VOLTAGE DIVIDER PHE001SC3 FOR Kilovoltmeters

$2507.99



Vintage Universal High voltage divider 35 kV max made in ex-USSR Boxed NOS picture

Vintage Universal High voltage divider 35 kV max made in ex-USSR Boxed NOS

$95.00



Low Voltage Protector Disconnect Switch Digital Over-Discharge Protection Module picture

Low Voltage Protector Disconnect Switch Digital Over-Discharge Protection Module

$14.35



Renogy 500A Battery Monitor High and Low Voltage Programmable Alarm 500A Shunt picture

Renogy 500A Battery Monitor High and Low Voltage Programmable Alarm 500A Shunt

$70.99



USB Type C Voltmeter Current Meter Multimeter Voltage Digital Tester Detector  picture

USB Type C Voltmeter Current Meter Multimeter Voltage Digital Tester Detector

$105.43







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