Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 82
Registered: ‎12-16-2010
My Device: BlackBerry Storm 9950
Accepted Solution

Consuming a Click AND Center Alignment

Goodday,

 

I am trying to center align a ButtonField.  When I include the code

 

 

ButtonField btn = new ButtonField("Log In", ButtonField.FIELD_HCENTER);

 

 

the Button successfully aligns to the middle of the screen.

 

However, when I click the button, the context menu comes up.

 

In order to get rid of it I have to write.

 

ButtonField btn = new ButtonField("Log In", ButtonField.CONSUME_CLICK);

 

 

I have tried to have them both, but I can't achieve that.

 

How can I go about accomplishing this?

 

Any help would be greatly appreciated.

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Consuming a Click AND Center Alignment

These are bit values - You have to "OR" these together:

 

ButtonField btn = new ButtonField("Log In", ButtonField.CONSUME_CLICK | ButtonField.H_CENTER);

 

Highlighted
Developer
Posts: 82
Registered: ‎12-16-2010
My Device: BlackBerry Storm 9950

Re: Consuming a Click AND Center Alignment

[ Edited ]

Thank you Rex for answering, I really appreciate it.