BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   how do i center my fields verticly (http://www.blackberryforums.com/developer-forum/138020-how-do-i-center-my-fields-verticly.html)

omrib 07-02-2008 08:57 AM

how do i center my fields verticly
 
Hey everyone.
I'm trying to set my VerticalFieldManager to center my fields in it verticly, so that it will space up my fields.

i tried creating the manager this way
VerticalFieldManager(VerticalFieldManager.FIELD_V CENTER
| VerticalFieldManager.USE_ALL_HEIGHT);

but still, all my fields go one after the other on the top and i get a lot of empty space in the bottom.

what is the recommended way to space up the fields? (or how to i center the fields vertically)

Also, whats the difference from VCENTER and FIELD_VCENTER?

thanks in advance.
Omri.

simon.hain 07-02-2008 09:50 AM

create your own manager

omrib 07-02-2008 02:52 PM

The default Vertical Screen manager cant center fields vertically?

holy3daps 07-02-2008 03:18 PM

Centering Fields
 
Hi!

So, are you looking to do something like this (A):

.........Field 1.........
.........Field 2.........
.........Field 3.........

Or something like this (B):

..................................
..................................
..................................
..Field 1..Field 2..Field 3..
..................................
..................................
..................................

(A) centers fields horizontally (all fields are aligned with the horizontal center of the screen)
(B) centers fields vertically (all fields are aligned with the vertical center of the screen)

Using just a VerticalFieldManager all by itself will do neither of these - a VFM only lays out each field it contains vertically, one row at a time, left-justified.

To do (A), you need two things: a VFM (to layout each field on its own separate line), and a Style value (Field.FIELD_HCENTER) set on each field through the field's constructor.

To do (B), you may be able to get away with using a HorizontalFieldManager (to layout each field in one row, left to right), and a Style value (Field.FIELD_VCENTER) set on each field through the field's constructor. However, not actually having done this myself, I'm not sure whether that will actually give you (B) - it may vertically center the fields in the first "row", which will be the top of the screen. You may be able to combat this by setting the style value of the HFM to Field.FIELD_VCENTER.

If you're really aggressive and/or curious and/or bored, you can create your own brand of Manager, and do it brute-force.

Experiment! That's what coding is all about, really. And that's why God invented BlackBerry simulators.....

Cheers,

karl

omrib 07-03-2008 09:35 AM

actually what i want is something else.
say i have 5 lines of space on the device, but i only put 3 fields.
so i want something like

field.....
..........
field.....
..........
field.....

Is that possible with the vertical manager? or do i need to create my own custom manager?

simon.hain 07-03-2008 10:39 AM

you can use a spacerfield or create your own manager.


All times are GMT -5. The time now is 10:36 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.