Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 07, 2019 9:42 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [SOLVED] Canvas Drawstring issue
PostPosted: Fri Sep 21, 2012 10:08 am 
Offline

Joined: Sun Nov 18, 2007 11:19 am
Posts: 140
Location: New Brunswick, Canada
I am having a problem with Drawstring not actually working on a Canvas control. I have a button and in the Action it sets the Canvas HelpTag to some text and throws a Canvas.refresh. I know for sure the code is executing (I put a msgbox inside the IF and it is triggering). Can anyone see something wrong with this code? Did I forget something?

The below code is in the Canvas Paint event:
if me.HelpTag <> "" then
dim tmp as String = me.HelpTag
me.HelpTag = ""
g.TextFont = "courier new"
g.TextSize = 12
g.DrawString tmp, 10, 10
end if


Last edited by reets on Fri Sep 21, 2012 10:44 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas Drawstring issue
PostPosted: Fri Sep 21, 2012 10:33 am 
Offline

Joined: Mon Oct 13, 2008 4:26 am
Posts: 63
It works fine for me here.

Does your canvas have anything in the help tag?

RB 2012r1 OS X 10.8.1 and RB 2012r1 Win 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas Drawstring issue
PostPosted: Fri Sep 21, 2012 10:34 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
The problem is that the canvas needs to know what the string is EVERY time it needs to draw (i.e. refresh). Just doing it once isn't good enough since the paint event might happen thousands of times. Set the string to a global variable on the window and then see what happens.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas Drawstring issue
PostPosted: Fri Sep 21, 2012 10:44 am 
Offline

Joined: Sun Nov 18, 2007 11:19 am
Posts: 140
Location: New Brunswick, Canada
And once again the forums come through. Fixed and thank you a LOT. First time actually using a Canvas for something other than images.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group