Yes but that doesn't help much if the picture is created in one method /
event,
and the picture's content is created in another method (or methods),
which is the case in my program.
Before we turn this into another lengthy thread
I will now strip down the program until I find the cause of this mischief.
Phil M wrote:
> On Feb 22, 2005, at 12:31 PM, Eirik Karlsen wrote:
>
> > In the window's Open event a new picture is defined like this,
> > GraphFront=newPicture(CanvasGraph.width,CanvasGraph.height,8),
> > and the variable is given a Public scope in the window's Properties,
> > and in a method I try to access it by either
> > GraphFront.graphics.DrawPicture GraphFront,0,0 or
> > s=GraphFront.graphics
>
> It is always a good idea to check for Nil before you try to access
> something like this. In fact, when I want to invalidate a picture I
> usually set it to Nil so that it would be created from scratch. For
> example, this is similar to what I have in my Paint event for my Canvas
> so that double-buffering works.
>
> If GraphFront Is Nil Then
> RenderGraphFront() // contains the code to create GraphFront
> End If
>
> g.DrawPicture(GraphFront, 0, 0)
>
> Although technically I can still get a NilObjectException if there is
> not enough memory to create the GraphFront picture. This *should* only
> be an issue on OS 9:
>
> GraphFront = NewPicture(w, h, 32) // NewPicture returns Nil if not
> enough memory.
>
> ______
--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|