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