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: 35
Registered: ‎03-08-2009
My Device: Not Specified
Accepted Solution

How do I get the StatusBar manager? (MainScreen)

I have an issue where the background color for the field/manager managing my banner (MainScreen.setBanner) is set to a certain color, but when I set my status bar to the same color, it appears differently.  I believe this is because the main manager is set to a different color (other than white), and the banner is drawn on top of that resulting in a different color - while the statusbar background is white (despite what is set in the main manager).  I've tried to achieve the same in the statusBar, with no luck.  From within the manager subclass that is managing the elements in the statusBar, I've tried "this.getManager.setBackground()", but this fails silently.    I've tried manager within a manager, setting the backgrounds accordingly, but this doesn't work either.  Is there a way to do this?  Or has my logic been flawed from the onset as to why the colors appear differently? Thanks

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I get the StatusBar manager? (MainScreen)

Code like the following seems to work for me.

 

        VerticalFieldManager vfm = new VerticalFieldManager() {
            public void paintBackground(Graphics g) {
                int backgroundColor = 0x0000FF00;
                g.setBackgroundColor(backgroundColor);
                g.clear();
            }
        };
        vfm.add(new LabelField("Test", LabelField.USE_ALL_WIDTH));
        this.setStatus(vfm);

I agree that the status and title areas of MainScreen sometimes behave a little differently - for example the title area background seems to be black and text white by default.  But I have never had any problems getting them they way I want by forcing the specific colors I wanted.

 

In summary, yes title and status probably behave a little differently so you might have to override the default color processing for these areas. 

Developer
Posts: 35
Registered: ‎03-08-2009
My Device: Not Specified

Re: How do I get the StatusBar manager? (MainScreen)

Thank you for the response Peter.  But the problem was that the colors seem to appear differently, not that I wasn't able to set them.  I was attributing it to the different background colors, and possibly incosistent behaviour in Graphics.  But I will simply dismiss as an optical illusion. Thanks anyway.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I get the StatusBar manager? (MainScreen)

Don't think it is your eyes, as I hope was clear from my previous post, status and especially title have difference default background and 'foreground' colors.

 

Anyway, can you mark this as solved - instructions in Help link at top if needed.