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: 30
Registered: ‎12-02-2010
My Device: BlackBerry 8520

Re: Align to bottom of vertical field manager

Hello you can use

 

setStatus(Managers or etc);

 

to add any manager at the bottom of the screen.

Adil Soomro

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

Re: Align to bottom of vertical field manager

FIELD_TOP, FIELD_BOTTOM and FIELD_VCENTER are ignored by VerticalFieldManager, just like FIELD_LEFT, FIELD_LEADING, FIELD_RIGHT, FIELD_TRAILING and FIELD_HCENTER are ignored by HorizontalFieldManager. These managers have their own policy of vertical and horizontal positioning, respectively.

 

Your solution, therefore, is the most elegant one. Just replace getPreferredHeight() with getHeight() - at that point your footer manager has been laid out just like everything else, so it already knows its actual height.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
New Contributor
Posts: 4
Registered: ‎06-26-2011
My Device: 9550i Storm2

Re: Align to bottom of vertical field manager

Thanks! This was exactly what I needed to solve very similar problems. Life saver! ;-)
New Contributor
Posts: 9
Registered: ‎09-01-2011
My Device: Blackberry Torch 9800

Re: Align to bottom of vertical field manager

Super(NO_VERTICAL_SCROLL);
HorizontalFieldManager hfm =
new HorizontalFieldManager(FIELD_BOTTOM|USE_ALL_HEIGHT);
add(hfm);
hfm.add(new LabelField("status", FIELD_BOTTOM);

add(hfm);

Well the above works like a charm, even tho its an old post I knw it wl b useful to someone
Contributor
Posts: 42
Registered: ‎03-17-2012
My Device: Blackberry playbook

Re: Align to bottom of vertical field manager

The solution could be this:

 

public final class MyScreen extends MainScreen
{
    /**
     * Creates a new MyScreen object
     */
    public MyScreen(){
         super(Screen.NO_VERTICAL_SCROLL | Screen.NO_VERTICAL_SCROLLBAR);
            // Set the displayed title of the screen
            setTitle("Posicionamiento de elementos en la Screen");

            VerticalFieldManager containerManager = new VerticalFieldManager(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT);
            containerManager.setBackground(BackgroundFactory.createSolidBackground(Color.YELLOW));

            VerticalFieldManager vfm = new VerticalFieldManager();
            vfm.setBackground(BackgroundFactory.createSolidBackground(Color.RED));

            vfm.add(new LabelField ("Field 1"));
            vfm.add(new LabelField ("Field 2"));

            HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.USE_ALL_HEIGHT | Manager.FIELD_HCENTER);
            hfm.setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));


            hfm.add(new LabelField ("Field 3", Field.FIELD_BOTTOM));

            containerManager.add(vfm);
            containerManager.add(hfm);

            this.add(containerManager);
        
        }
}