Morphic>>step

Bob Arning arning at charm.net
Fri Nov 6 00:36:03 UTC 1998


On Thu, 05 Nov 1998 20:20:28 -0300 Gerardo Richarte <gera at core-sdi.com> wrote: 
>    I can understand why this happens, and that itís perfectly normal
>(if there is such an error), but Iíd like to have a way of stopping
>this, or better, to make the morph stop stepping if there is an error in
>its #step method.
>    Any idea out there?

Richie,

One solution is to alter the #step (or #drawOn: or whatever) to something like:

step

    inProgress ifTrue: [^self]
    inProgress _ true.
.... do real stepping stuff here
    inProgress _ false.

where inProgress is an instance variable. This way, if you get a walkback in a Morph's #step (or whatever) method and you do not manage to proceed through it, the Morph will not try the same (presumably bad) thing again.

Cheers,
Bob





More information about the Squeak-dev mailing list