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
New Developer
Posts: 14
Registered: ‎03-13-2009
My Device: Not Specified

LabelField Alignment problem in PhoneScreenHorizontalManager

Please help to on PhoneScreen

 

I want put to 2 label field in in single row in screen.

 

I try with all possible combination of Style argument.

 

LabelFied.LEFT | LabelField.USE_ALL_WIDTH

Field.FIELD_RIGHT | Field.USE_ALL_WIDTH

DrawStyle.RIGHT | Field.USE_ALL_WIDTH

DrawStyle.RIGHT | DrawStyle.TRAILING |Field.FIELD_RIGHT | Field.USE_ALL_WIDTH

DrawStyle.RIGHT | DrawStyle.TRAILING |LabelField.FIELD_RIGHT | LabelField.USE_ALL_WIDTH

 

eg.

 

LabelField1.............................LabelField2

 

 

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: LabelField Alignment problem in PhoneScreenHorizontalManager

HorizontalFieldManagers do not respect horizontal alignment flags - they have their own horizontal placement approach.

 

One of the possibilities is to use margins (which are respected by most of the BlackBerry built-in Managers):

- calculate LabelField sizes using labelField.getFont().getAdvance(labelField.getText())

- calculate and set the right margin on your left field (or the left margin on your right field).

 

Even though Field.setMargin() is documented only in 6.0 API, it's been working for quite a while (at least since 4.2.1).

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!