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
Trusted Contributor
Posts: 167
Registered: ‎06-30-2011
My Device: n/a
My Carrier: Koodo
Accepted Solution

setStatus is blocking out background?

I have several pages with a 'next' button on the bottom of the page. I just started using this code today to make sure the 'next' button stays at the bottom of the page. However, it blocks out the background image I have on the screen and instead only shows white. Does anybody have a solution? Thanks Smiley Very Happy

 

//bunch of code including a background image

 

HorizontalFieldManager Hman = new HorizontalFieldManager();
Hman.add(nextBut);
this.setStatus(Hman);
       
add(Vman);

Super Contributor
Posts: 278
Registered: ‎11-04-2010
My Device: 4.5 and above
My Carrier: none

Re: setStatus is blocking out background?

Hi questionman,

    For your requirement just create a custom manager extending manager and set the extent to display.getHeight() - 30.

  Here 30 pixel is for last button at the bottom.Add all other things for that customManager, add this customManager to main screen and later add your button to main screen.This has worked for all device for us.

public class VCenterManager extends Manager {
        public VCenterManager() {
            super(Manager.USE_ALL_WIDTH);
        }

        private int getInitialY(int numberOfFields){
            int y = Display.getHeight();
            for (int i = 0;i < numberOfFields;i++) {
                y -= getField(i).getHeight();
            } 
            return y/2;
        }

        protected void sublayout(int width, int height) { 
            Field field;
            int numberOfFields = getFieldCount();
            int x = 0;
            int y = getInitialY(numberOfFields);
            for (int i = 0;i < numberOfFields;i++) {
                field = getField(i); //get the field
                setPositionChild(field,x,y); //set the position for the field
                layoutChild(field, width, height); //lay out the field
                y += field.getHeight();
            }
            setExtent(Display.getWidth(), Display.getHeight()-30);
        }

    }

 This class is for aligning fields in the centre of screen as well as see the setExtent, height is lesser by 30 pixel.

 

Thanks & Regards

       pp

 

Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: setStatus is blocking out background?

for a more general example check
http://supportforums.blackberry.com/t5/Java-Development/Create-a-custom-layout-manager-for-a-screen/...

the status area does not use the background set in the screen, for whatever reason, so you have to create your own.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Trusted Contributor
Posts: 167
Registered: ‎06-30-2011
My Device: n/a
My Carrier: Koodo

Re: setStatus is blocking out background?

Ok, seeing as how I'm not yet at the point of creating custom things (seems a bit complicated at the moment) I will leave this problem until my app is done to the point of looks. Thanks for the help both of you!