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: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

GridFieldManager center alignment issue

I am adding gridfieldmanager. I want this manager center aligned horizontally. 

grid = new GridFieldManager(1,3,Manager.FIELD_HCENTER);

Above code working fine on simulator for OS 5 and 6. But on device having OS 6 and 7 FIELD_HCENTER is not working. grid gets set on left side of the screen. how can i solve this issue?

Developer
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: GridFieldManager center alignment issue

Hi,

Do one Thing.

 

VerticalFieldManager vfmMain = new VerticalFieldManager(USE_ALL_WIDTH );

grid = new GridFieldManager(1,3,Manager.FIELD_HCENTER);

 

vfmMain.add(grid);

 

I think this is helpfull to you.

All The Best

 

 

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: GridFieldManager center alignment issue

Thanks milanvishal.I tried this. It doesnt affect in alignment of grid.
Developer
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: GridFieldManager center alignment issue

Ohhhhhhh,

Sorry,then I dont have any idea for gridmanager.

If possible can you post your code here so looking into your code may be I help you.

 

Regards,

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: GridFieldManager center alignment issue

I am not doing anything else.
Just adding image and label in verticalfieldmanager. and adding this vfm to grid.
Developer
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: GridFieldManager center alignment issue

I am asking because I have never used Gridmanager.

Always I used verticle & horizotal fieldmanager to create UI.

 

 

Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: GridFieldManager center alignment issue

[ Edited ]

I am using TableLayoutManager now. I got my solution.

http://supportforums.blackberry.com/t5/Java-Development/Create-a-rich-UI-layout-with-TableLayoutMana...

But still i am eager to know "why i was not able to set GridFieldManager at center of the screen?"

Developer
Posts: 201
Registered: ‎12-17-2010
My Device: Not Specified

Re: GridFieldManager center alignment issue

ok.

That's great.

Congratulations!!!!!!!

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

Re: GridFieldManager center alignment issue

As a built-in Manager, GridFieldManager might change funtionality between OS versions. Table Layout Manager, being a custom one, is much more stable. If you want predictability, go with TableLayoutManager. Its performance will be lower, of course, but it shouldn't be too bad.

 

It sounds like GridFieldManager started behaving as though USE_ALL_WIDTH is always on at some point. There are fields which also manifest such behavior. Some have style bits of inverse meaning (see RichTextField.USE_TEXT_WIDTH), others need to be curbed from outside to work the way want. If you want to customize this behavior, override sublayout of your GridFieldManager, calculate the total width there (especially useful if you have your own getColumnWidth) then call super.sublayout(yourWidth, maxHeight) - that should work better.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Highlighted
Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: GridFieldManager center alignment issue

[ Edited ]

I will try it out. I have more stuff to do with grid layout. I hope TableLayoutManager will help me.

I have posted one more query regarding GridFieldManager. 

http://supportforums.blackberry.com/t5/Java-Development/Set-width-to-GridFieldManager-according-to-f...