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: 24
Registered: ‎02-10-2010
My Device: 9550
My Carrier: XL
Accepted Solution

Manager style precedence?

[ Edited ]

I want to use VerticalFieldManager to be centre-aligned horizontally, and use all available width. Therefore, I tried the following code:

middleMgr = new VerticalFieldManager(Manager.FIELD_HCENTER | Manager.USE_ALL_WIDTH);


However, the above code does not produce the UI that I wanted. The manager will use all width, but the field is left-aligned. If I use the style specifier individually like as:

 

middleMgr = new VerticalFieldManager(Manager.USE_ALL_WIDTH);

 

the manager will use all width, but left-aligned. If I use:

middleMgr = new VerticalFieldManager( Manager.FIELD_HCENTER);

 

the manager will lay out the fields centre-aligned, but because I use a color background, I can see that the vertical manager does not use the whole width of the screen.

Q: Is there any order of style that any manager shall be used? From the case above, it seems that if there is Manager.USE_ALL_WIDTH is present, MANAGER.FIELD_HCENTER is ignored). Am i missing something?

 

OPrayogo
Trusted Contributor
Posts: 177
Registered: ‎03-02-2010
My Device: Not Specified

Re: Manager style precedence?

[ Edited ]

hi, have you tried by overriding sublaout method. u can set all width of manager by overriding this method and pass long(FIELD_HCENTER) when creating manager.

 

VerticalFieldManager vrtclmngr = new VerticalFieldManager(FIELD_HCENTER)

{

    protected void sublayout(int maxWidth, int maxHeight)

     {

         setExtent(Display.getWidth(), hieght);

         sublayout(Display.getWidth(), hieght);

     }

};

 

t may be help you!

Developer
Posts: 85
Registered: ‎05-03-2010
My Device: Not Specified

Re: Manager style precedence?

Dear rrr_04;

When posting code use the "Insert Code" option which is displayed with the icon that shows A clipboard and a big C on it. Here's your formatted code for better readability

 

 

VerticalFieldManager vrtclmngr = new VerticalFieldManager(FIELD_HCENTER) { 
    protected void sublayout(int maxWidth, int maxHeight) {       
        setExtent(Display.getWidth(), hieght); 
        sublayout(Display.getWidth(), hieght); 
    }
}; 

 

 

Contributor
Posts: 24
Registered: ‎02-10-2010
My Device: 9550
My Carrier: XL

Re: Manager style precedence?

Hi rrr_04,

 

Thanks for your reply. Actually, I have managed to find a workaround to the problem, I was just wondering whether there is a rule in applying style specifier to any manager. I spent alot of time scratching my head trying to figure out whats the rule are, there is no documentation anywhere in regards to that. :smileyhappy:

 

I dont know whether the behaviour that I said in my first post was an expected behaviour or it is a bug.

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

Re: Manager style precedence?

FIELD_HCENTER is meaningless with USE_ALL_WIDTH - the field (in this case your Manager is that Field) will use all available width (duh!) and therefore will be justified left, right and center.

 

You may want to use FIELD_HCENTER in the fields added to your USE_ALL_WIDTH VFM.  That's where it makes sense.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Contributor
Posts: 24
Registered: ‎02-10-2010
My Device: 9550
My Carrier: XL

Re: Manager style precedence?

thank you arkadyz. Your explanation makes sense. :smileyhappy:

OPrayogo