#fullDrawOn:

Ned Konz ned at bike-nomad.com
Mon Apr 28 16:15:29 UTC 2003


On Monday 28 April 2003 08:53 am, Paul Chapman wrote:
> I'm starting to find out where the code hooks into Morphic are.  I
> found #fullDrawOn:, which looks like the place to put my drawing
> code for a pane.  But I have a few simple questions.
>
> (1) Is this the only drawing hook?  What's #drawOn: for?

You probably want to override #drawOn: instead.
#fullDrawOn: also takes structure into account; unless you don't need 
or want to draw your submorphs you shouldn't have to override it.

> (2) The canvas argument my pane is passed does not seem to be
> clipped to the pane.  This surprised me.  Is this the right
> behaviour?  Am I supposed to do my own clipping using something
> like #clipBy:during: ?

Do you have clipping turned on in your Morph? And in your Morph's 
parents? You talk about a "pane"; does this mean that your Morph's 
parent is a SystemWindow? Have you tried turning on clipping on the 
SystemWindow? Usually the canvases that we render to have clipping 
turned on.

> (3) I noticed that when my window is first creatd and displayed,
> #fullDrawOn: is called three times.  This seems excessive. :)  I'm
> used to battling the Windows API to stop unnecessary extra WM_PAINT
> messages.  Am I up against the same kind of thing in Squeak?

Are you doing something like creating your Morph, then setting the 
extent, then moving it? Each change to the bounds or position can 
result in a repaint.

> (4) Squeak seems to have problems coping with errors during the
> execution of #fullDrawOn: -  I get a stack dump to the screen
> instead of a debugger, and the image usually dies.  This makes code
> here hard to debug.  Is there a general approach to debugging
> drawing code to work around this?

You can often type "exit" or "revert" at the emergency debugger and 
have the right thing happen. Though there are some places in the code 
that should be wrapped in exception handlers and aren't.

As I said some time ago:

So I'd probably try replacing the call to displayWorld in 
SystemWindow>>passivate with displayWorldSafely, which *does* have 
proper error handling.

and:

It looks to me like #displayWorldSafely should be called from most of 
the places that #displayWorld is, but I haven't really analyzed it.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list