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
Contributor
Posts: 26
Registered: ‎05-26-2011
My Device: TORCH 9800
My Carrier: T Mobile

Re: center ButtonField inside HorizontalFieldManager - how to ?

Using a GridFieldManager (and setting columns and rows properties) is the easiest way I found to put component where I want quickly.
So a Horizontalfieldmanager in a verticalfieldmanager (which in this case is the same) seems the easiest and faster way,
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: center ButtonField inside HorizontalFieldManager - how to ?

It is obvious that VerticalFieldManager cannot respect vertical alignment bits just as HorizontalFieldManager ignores horizontal ones - so you are either stuck with two containers (the inner one will USE_ALL_... - height for horizontal manager, width for the vertical one), or need to use some custom layout. Which is an extremely simple thing to do (and a very educational, too), so, like simon_hain, I highly recommend it.

 

If you are stuck and don't know how to do that, search this forum for CenteringManager and ignore the background painting part for now - you can get back to it later on.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Trusted Contributor
Posts: 224
Registered: ‎08-11-2010
My Device: Not Specified

Re: center ButtonField inside HorizontalFieldManager - how to ?

I gava "kudos" to everybody that participated in that discussion. Thanks everybody !

 

Not yet sure about which comment I should accept as answer ...

Trusted Contributor
Posts: 159
Registered: ‎02-17-2011
My Device: Not Specified

Re: center ButtonField inside HorizontalFieldManager - how to ?

do u solve  ur query?

 

 

Highlighted
Developer
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer

Re: center ButtonField inside HorizontalFieldManager - how to ?

[ Edited ]

try to ovverride add method :

 

public void add(Field field)
 {
        field.setMargin((fieldHeight - field.getPreferredHeight())/2, 0, 0, 0);
        super.add(field);
 }

 

of course you must extend your custom manager from Horizontal or Vertical FieldManager.

Regards,
Arsen