BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   How to set tooltip to BitmapField? (http://www.blackberryforums.com/developer-forum/159371-how-set-tooltip-bitmapfield.html)

gsk_56 11-13-2008 01:36 PM

How to set tooltip to BitmapField?
 
Hi,

I have one bitmapfield i need to set tooltip for this. I tried this by overriding drawFocus() method in BitmapField but i dont know much about Graphics class. How i can do this please let me know if you having any sample code please send it to me. Advanced Thanks.

gsk_56 11-14-2008 01:22 AM

Please provide help i was strucked here.

Advanced Thanks.

Dougsg38p 11-14-2008 08:43 AM

Did you read the API docs?

Sounds like you are in the right place. Use drawText() in the Graphics class to display the tip. You might want to do a "fill" so that the text has an opaque background.

Of course, the drawback of your strategy here is that you can only paint within the extent of the BitmapField if you use this field paint() or drawFocus() methods. If you want the tip to appear elsewhere, you'll have to override the paint() method in the field's container (Screen).

gsk_56 11-14-2008 11:10 AM

Hi Dougsg38p,

Thanks alot for your reply.

As per you exactly i structed at extending the size of the tooltip because i am overriding drawFocus(). As per your suggestion i will going to override paint() of MainScreen for displaying large tooltips. FYI i am using below drawFocus() now.

protected void drawFocus(Graphics graphics, boolean on)
{
XYRect xy = graphics.getClippingRect();
graphics.setColor(Color.BLACK);
graphics.drawRect(5,15,xy.width+10+2,xy.height-15+2);
graphics.setColor(Color.SILVER);
graphics.fillRect(5,15,xy.width+10,xy.height-15);
graphics.setColor(Color.BLACK);
graphics.drawText("news profiles", 5, 15);
}


All times are GMT -5. The time now is 05:25 AM.

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