You’re a smart guy, figure it out!

Mike Grushin’s thoughts on everything tech-related and more…

Archive for the ‘BlackBerry JDE’ Category

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:

image

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

Posted in BlackBerry, BlackBerry JDE | Tagged: , , , , | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.