08-10-2010 02:44 PM
I have a customized BitmapField which I would like to drawText, using graphics.drawText. Previously, i had no problem as i would call setBitmap from the paint method and this would do the drawText. However, it caused an infinite loop problem so i moved it to another function, which will manually set the bmp. Now i am unable to drawText, as i have placed this code within my paint() function. I would like, however, when i select this particular BitmapField , to drawText.
For the moment, setBitmap from another function is not a very good option as this will call the FieldManager's sublayout which i think may cause a stack problem. Is there any other way i can call drawText from?
Solved! Go to Solution.
08-10-2010 03:16 PM
What is the reason, again, for not drawing text from inside the paint()? Why would you need to setBitmap() to draw the text in the first place?
Indeed, setBitmap() inside paint() will cause an infinite loop (I remember that post). However, it should not be linked to drawing text in any way, shape or form.
Check some variable (member) inside your paint() method and do the draw you need depending on that value. If you want your bitmapField to draw text under some conditions, change the value of that member and invalidate(), causing paint() to pick up the change.
Also, if your FieldManager's sublayout causes a problem, it has a problem. Review that code and fix the bugs rather than masking them with all kinds of moving code around.
If you need further assistance, please post here the relevant code pieces (especially how you would draw the text back when it worked) and we'll figure out something.
08-11-2010 12:17 AM
hi there, thanks for your reply. i will try to debug first as mentioned. Starting from my sublayout. I'm pretty new to all this and my grasp on the whole dynamics is not very firm so it will take me some time. The main reason with my sublayout of my FieldManager, is that i customized it quite a bit. so certain things, as you have mentioned is not working well. As i'm moving icons around the FM, i'm using insert, delete, etc as posted in my other posts, and i manually setfocus and even animate the icons. So now it's giving me a bit of a headache. Ha ha. Thanks again for all you guys' precious feedback and assistance. For this particular problem, i'll try to debug my FM's sublayout as well as navigationMovement first.... I'll post the codes if i am stuck at the crossroads once more... Thank you...