How to execute code at startup

Aaron J Reichow reic0024 at d.umn.edu
Wed Feb 6 16:17:18 UTC 2002


Hi!

> I'm trying to use Squeak for creating a game that is supposed to
> automatically start when the user opens the image. How do I get Squeak
> to start running my startup code as soon as the image is opened?

It's easy-

First, add a #shutDown method on the class-side of your class.
and then execute "Smalltalk addToStartUpList: YourClass."

There's also a #addToShutDownList: if you need a method called when the
image is shutting down.  Just throw on a #shutDown method on the class
side.

Also of interest may be SystemDictionary>>#addToShutDownList:after:
and SystemDictionary>>#addToStartUpList:after: which do the same thing,
but allow you to have some order in which they occur.

Regards,
Aaron

  Aaron Reichow  ::  UMD ACM Pres  ::  http://www.d.umn.edu/~reic0024/
"the only difference it makes if some dust on the clay"  :: atmosphere




More information about the Squeak-dev mailing list