I have 2 canvases, one on a 2nd screen. I draw a picture to that one, then draw a reduced version to the 1st screen. When I use .refresh, all is well. But when I use .invalidate, the reduced picture appears on both canvases. It appears to me the program is double-buffering the image first to the 2nd screen, then to the first. I can solve this by simply using .refresh, but I prefer to use .invalidate for the flickering issues it solves.
Is there a simple solution to this problem? Is this a bug in Xojo?
Here’s the code for a method that does the drawing:
[code] dim w, h as integer
gString = PrepVerses(wPresentation(gPresIndex))
w = DisplayerWnd.Width
h = DisplayerWnd.Height
gPic = New Picture (w,h)
Looks like you’re using the same picture object for both canvases. When you drawlittlepic, it overwrites the contents of gpic. Try creating a separate picture for each canvas.
since both invalidates are in the same process, and as Will said its a “draw later” (or draw when I have free time)… that “free time” isn’t until the END of the method… therefore both canvas get sent the event trigger at the same time…
All “invalidate” does is put a message in the queue, it does NOT execute that message immediately
REFRESH will, but that has issues of its own, and should be used sparingly (in my opinion)
I see. I was indeed using the same picture object for both canvases because I wanted to simply scale it down in the smaller canvas. I guess I can just make a copy and do that.
Thanks again, Will and Dave. This board has been a great help to me.
You could also use the paint event of the canvases to do the scaling. Then you won’t need to make 2 copies. Just depends on what your goal is.