Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Canvas.Paint difference between Mac OS X and Windows XP platforms (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: App not responding
Next thread: Really nasty problems with overlapping controls - in particular cross-platform.


Win32 API Declares   -   Berg, Heath
  Canvas.Paint difference between Mac OS X and Windows XP platforms   -   Emile Schwarz
   Re: Canvas.Paint difference between Mac OS X and Windows XP platforms   -   Joseph J. Strout

Canvas.Paint difference between Mac OS X and Windows XP platforms
Date: 19.08.05 11:50 (Fri, 19 Aug 2005 12:50:50 +0200)
From: Emile Schwarz
Hi all,

REALbasic 5.5.5 and 2005R2
Mac OS X 10.4.2
Windows XP SP2

Found in a Canvas.Paint event:

Sub Paint(g As Graphics)
If OffscreenPict = Nil Then

Else
Me.Backdrop = OffscreenPict
End If
End Sub

Works fine under Mac OS X and flicked like hell (who said that Hell flick ?)
when running under Windows XP SP2.

The solution is to assign the OffscreenPict out of the Paint event [but I have
that wrong habbit].

What I called in the previous paragraph 'wrong habbit' is nice under some
circumstances (everywhere I do not run that project under Windows)...

... and so the question is:

Is it a bad idea to assign to a Canvas' Backdrop (or Window background) an
offscreen Picture ?

TIA,

Emile

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Canvas.Paint difference between Mac OS X and Windows XP platforms
Date: 19.08.05 17:21 (Fri, 19 Aug 2005 10:21:06 -0600)
From: Joseph J. Strout
At 12:50 PM +0200 8/19/05, Emile Schwarz wrote:

>Found in a Canvas.Paint event:
>
>Sub Paint(g As Graphics)
> If OffscreenPict = Nil Then
>
> Else
> Me.Backdrop = OffscreenPict
> End If
>End Sub

Zow! This is a bit like finding an abandoned land mine in your back
yard. It's dangerous and you want to get rid of it ASAP.

In particular, one should never assign to the Backdrop of a canvas in
the Paint event. Either assign the backdrop somewhere else, and
don't touch it in the Paint event (perhaps you don't need anything at
all in your Paint event), or forget about the Backdrop property, and
instead simply do

g.DrawPicture OffscreenPict, 0, 0.

The latter is what I usually do, but I know some people prefer using Backdrop.

>The solution is to assign the OffscreenPict out of the Paint event
>[but I have that wrong habit].

Right. You'll want to fix that habit as soon as you can.

>What I called in the previous paragraph 'wrong habbit' is nice under
>some circumstances (everywhere I do not run that project under
>Windows)...

No, it's not. It's dangerous and incorrect anywhere.

>Is it a bad idea to assign to a Canvas' Backdrop (or Window
>background) an offscreen Picture ?

In the Paint event (or any method called by that), yes. Anywhere else is fine.

Best,
- Joe