extending maloney's TestMorph

Andreas Raab Andreas.Raab at gmx.de
Wed Sep 26 02:30:17 UTC 2001


Hi Lyn,

> I realize I could simply fill the collection at initialization time,
> but my real question is: why is my morph getting put on the stepList
> and sent step messages?

Unfortunately, there's a bit of magic going on which causes some confusion.
The original thought was that when you have a #step method you want your
morph to be stepping (hey, what's the point otherwise ;-) So the mechanism
that decides whether a morph wants to step automatically basically checks if
you've implemented a #step method and if so, starts stepping as as soon as
the morph shows up in the world. [Important side note: This entirely
machinery got changed very many times in the past and this behavior is only
true for certain subclasses of morph. In your case it is but very many other
subclasses override this behavior in similar ways as described below]

What you have to do to get the correct behavior is simply to implement a
method

TestMorph>>wantsSteps
	"Return false since I don't want to step automatically."
	^false

and it should work. [Another side note: This is one of those methods where
the semantics doesn't really match the name. It should really be called
#autoStartStepping or somesuch to indicate that returning true will
automatically start stepping that morph. The above could lead the reader to
assume that this morph *never* wants steps but this is not the semantics of
the method which covers *exclusively* the automatic step invokation].

Hope this helps,
  - Andreas





More information about the Squeak-dev mailing list