BlackBerry JDE 4.2, ButtonField and disabling ContextMenu
Posted by mikeg on May 14, 2009
I’ve been playing around with BlackBerry JDE 4.2 for some time now and while using the simulator I would “click” on buttons using the Enter key. When I finally installed on the physical device I found that it is more intuitive to click on the button using the ball while moving around the screen. The problem is that by default it brings up a context menu which produces undesirable result:
Looking at API and doing a few google searches led me to implementing a subclass where I was planning to override either getContextMenu() or makeContextMenu(), but for some reason those methods were not being called. A few more random searches and turns out that you can pass ButtonField.CONSUME_CLICK and that will eliminate the undesirable display of the context menu.
Here is excerpt from API that fails to mention CONSUME_CLICK
ButtonField
public ButtonField(String label,
long style)Constructs a new ButtonField instance with provided label and style.
Provided a label string to show, and a style, this method builds a button field using your style.
Parameters:
label – Label string for the button.
style – Field style for the button: can be a combation of any generic field style, BARE, DrawStyle.ELLIPSIS, Field.FOCUSABLE and Field.NON_FOCUSABLE
This entry was posted on May 14, 2009 at 11:27 pm and is filed under BlackBerry, BlackBerry JDE. Tagged: BlackBerry, BlackBerry JDE, blackberry jde 4.2, buttonfield, contextmenu. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.