How do I get a method in one of my own classes to fire when Squeak first
launches? -Thanks, Jim |
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 |
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 - |
On Sun, Sep 07, 2008 at 05:13:05PM +0200, Bert Freudenberg wrote:
> > 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 ;) Oops! Well, I guess that must be the reason for step 3 ;) Dave |
In reply to this post by Bert Freudenberg
On Sep 7, 2008, at 5:13 PM, Bert Freudenberg wrote: >> 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 - It's fair to mention that you can indicate where in the sequence of startup items you would like to start addToStartUpList:after: Obviously if you are fiddling with the font system (aka Sophie) you want to do that *before* the Morphic/Tweak UI startup: runs... -- = = = ======================================================================== John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ======================================================================== |
Free forum by Nabble | Edit this page |