[squeak-dev] Execute on Launch?

Bert Freudenberg bert at freudenbergs.de
Sun Sep 7 15:13:05 UTC 2008


Am 07.09.2008 um 17:09 schrieb David T. Lewis:

> On Sun, Sep 07, 2008 at 10:41:59AM -0400, Jim Rosenberg wrote:
>> How do I get a method in one of my own classes to fire when Squeak  
>> first
>> launches?
>
> Step one:
> On the class side of your class, implement #startup: and have
> your #startup: method do whatever needs to be done on image startup.
> The parameter to the #startup: method will indicate whether the
> image is being restarted (versus resuming after an image save), so
> test for this (resuming ifTrue: [do my startup stuff]).
>
> Step two:
> In a #initialize class method for your class, add the line:
> 	Smalltalk addToStartUpList: self.
> Evaluate this one time to add your class to the system startup
> list. This causes your #startup: method to be called whenever
> the image is restarted.
>
> Step three:
> Save your image, restart, and see if it works.
>
> Dave

#startUp: works better ;)

- Bert -





More information about the Squeak-dev mailing list