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: 296
Registered: ‎12-07-2008
My Device: Not Specified
Accepted Solution

Is this possible?

I have an appliction in which I'm overriding the main grahics method.

 

I'm trying to add a HorizontalFieldManager but no matter what I can't get it to display ontop of te graphics. If I remove the graphics the field shows up just fine. Is there any way to put a HorizontalFieldManager on top of the grahpcis?

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Is this possible?

Are you adding the HFM before you activate your graphics methods? (a code snippet/proof of concept would be helpful)

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

I'm doing the following

 

 

public MyApp(){
    HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
    VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH);
    RichTextField rtf = new RichTextField("Hello World") {
        public void paint(Graphics graphics) {
            graphics.setColor(0xFFFFFF);
            super.paint(graphics);
        }
    };
    vfm.add(rtf);
    hfm.add(vfm);
    this.add(hfm);
}

protected void paint(Graphics g){
    super.paint(g);
    g.drawBitmap(0, 0, 360, 480, b, 0, 0); //Background
}

 

The fields are in the main method so, I guess they would be getting called before the paint method?

 

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Is this possible?

[ Edited ]

call super.paint after you draw your bitmap if that's what you're trying to accomplish and I would do one last invalidate after its added (even though it should be doing it for you).

 

Try it before adding that final invalidate call though. This is how I have one of my games set up so its compatible with all phones.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

 


JCarty wrote:

call super.paint after you draw your bitmap if that's what you're trying to accomplish and I would do one last invalidate after its added (even though it should be doing it for you).

 

Try it before adding that final invalidate call though. This is how I have one of my games set up so its compatible with all phones.


 

The image itself is showing up just fine, I'm just trying to display the field manager ontop of the image that has been painted.

 

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Is this possible?

[ Edited ]

Yeah. Move your super.paint in the paint method of your screen below the drawBitmap line.

 

protected void paint(Graphics g){
g.drawBitmap(0, 0, 360, 480, b, 0, 0); //Background
super.paint(g);

}
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

I tried that and the field shows, but not image is displayed. It's as if the graphics method isn' there at all.

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Is this possible?

Is it because you're using USE_ALL_WIDTH?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

 


JCarty wrote:

Is it because you're using USE_ALL_WIDTH?


 

I just removed the us all width and I'm still seeing the same outcome =/

 

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Is this possible?

[ Edited ]

Try using paintBackground instead  of paint to draw your bitmap and see how it works out. Usually works for me too. I can't see what's wrong with your code.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful