Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
tmountain
Posts: 90
Registered: 02-27-2009
Accepted Solution

Menu Question

I have an application that presents a context related second menu when the scroll wheel button is clicked on various items. The code works perfectly on modern phones with one exception. In a recent test, a user complained that clicking the scroll wheel was bringing up the standard blackberry menu rather than the secondary context menu.

 

I've narrowed this down to a setting in the phones preferences. It appears that Options->Screen/Keyboard->Menu Style must be set to Short Menu for this to work. If it's set to Full Menu, only the blackberry menu is available. I can see this problem manifesting itself often enough in the shipped product that it worries me. Is there a progromatic way to check this setting and either warn the user if it's set or more preferrably override the behavior and always make it act as if "Short Menu" is set within my application?

 

Thanks,

Travis

Please use plain text.
Developer
tmountain
Posts: 90
Registered: 02-27-2009

Re: Menu Question

More specifically, I've established that given makeMenu(Menu menu, int instance), the instance paramater is equal to 65536, or Menu.INSTANCE_CONTEXT if you prefer, when Short Menu is set but comes in as zero, or Menu.INSTANCE_DEFAULT, when Full Menu is set.
Please use plain text.
Developer
Posts: 1,474
Registered: 04-14-2009

Re: Menu Question

[ Edited ]
Context menu is not guaranteed to be available anyway. For example, on devices with a trackwheel there are no context menus at all. I think the unwritten contract of the DEFAULT_MENU is that it includes all the items that would be in the context menu too. So, if I understand your approach correctly, your approach is broken because you are probably displaying some menu items in context menus only. Context aka "small" menus are supposed to contain a subset of what's contained in the full menu.
Message Edited by klyubin on 08-28-2009 05:41 PM
Please use plain text.
Developer
tmountain
Posts: 90
Registered: 02-27-2009

Re: Menu Question

> For example, on devices with a trackwheel there are no context menus at all.

 

I have a device with a track wheel and the context menu works perfectly in my application, but I do get what you're saying with the context menu being a subset of the full menu. Thank you for the reply. I'd really like to be able to check if the short menu option is set in the global settings, so I can lay out the menu accordingly.

Please use plain text.
Developer
Posts: 1,474
Registered: 04-14-2009

Re: Menu Question

What I meant was that on devices with trackwheel there's no "small" menu with instance ID Menu.MENU_CONTEXT. Fields still produce context menus (same as on other, newer devices) and these context menus are incorporated into the full menu (Menu.DEFAULT_MENU).
Please use plain text.
Developer
tmountain
Posts: 90
Registered: 02-27-2009

Re: Menu Question

I'm not sure i follow you. This works on my Curve 8900 (with trackwheel):

 

 protected void makeMenu(Menu menu, int instance) {
    if (instance == Menu.INSTANCE_DEFAULT) {
        System.out.println("blackberry menu");
    } else if (instance == Menu.INSTANCE_CONTEXT) {
        System.out.println("trackball menu");
    }
}

Please use plain text.
Developer
Posts: 1,474
Registered: 04-14-2009

Re: Menu Question

Curve 8900 has a pearl (trackball). It's not a trackwheel at all. A trackwheel is what pre-Pearl 81xx devices used to have (e.g., an 8700). It's a wheel on the right-hand side edge of the device. The wheel can be scrolled up, down, or can be clicked. On these devices there was no dedicated Menu button, so the only standard way to invoke the menu was to click the trackwheel. There was no concept of Menu button click vs. trackwheel/trackball/trackpad click, and hence there was no full menu vs small menu -- there was only one (full) menu.
Please use plain text.
Developer
tmountain
Posts: 90
Registered: 02-27-2009

Re: Menu Question

Ok, I follow you (sorry for the confusion). Final question, do you know if there's a way to check the settings regarding what mode the menu is set to (Full or Short)?

Please use plain text.
Developer
Posts: 1,474
Registered: 04-14-2009

Re: Menu Question

Sorry, I'm not aware of an easy programmatic way to check that. You could, for example, inject a trackwheel click and then see whether the makeMenu is invoked with Menu.CONTEXT_MENU or not. However, as I said earlier, beware that on some devices there's no "small" menu anyway (e.g., an 8700 that only has a trackwheel and hence no "small" menu can run v4.2+ handheld software), so, if you want to support all BlackBerrys, you shouldn't be creating a small menu that contains menu items that are not there in the full menu.
Please use plain text.
Developer
tmountain
Posts: 90
Registered: 02-27-2009

Re: Menu Question

Gotcha on the earlier models. My project is divided into two builds, a legacy build, and a modern build, so older models are handled in a completely different manner. What API call is used to inject a trackwheel click? And again, thank you for all the help.
Please use plain text.