[Q] Running some Smalltalk code when opening a project

Andreas Raab Andreas.Raab at gmx.de
Tue Feb 12 16:35:28 UTC 2002


Hannes,

The player references come from the eToy system. When you write an eToy
script for the world it can be run when the world is opened (this is the
code you saw). If you _don't_ do eToy scripting you might consider to
use something like:

	World when: #aboutToEnterWorld send: #startUp to: anObject.
	World when: #aboutToLeaveWorld send: #shutDown to: anObject.

The two events are triggered whenever the world is left or entered
(including publishing operations). I used this for handling the hardware
accelerated rendering which needed a bit of careful attention during
project switches.

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Hannes Hirzel
> Sent: Tuesday, February 12, 2002 4:00 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: [Q] Running some Smalltalk code when opening a project
> 
> 
> 
> Hi 
> 
> I'd like to run some Smalltalk code, when a project opens.
> 
> In Project>enter: returningFlag revert: revertFlag
> saveForRevert: saveForRevert
> 
> there is a call
> 
> world triggerOpeningScripts
> 
> and the variable 'world' is a PasteUpMorph.
> 
> There the code is
> 
> 	"If the receiver has any scripts set to run on opening, run them
> now"
> 	| aPlayer |
> 	(aPlayer _ self player) ifNotNil:
> 		[aPlayer runAllOpeningScripts]
> 
> But I don't have a player defined. How do I do that?
> 
> I'd like to run a different script for most of my Project instances.
> 
> 
> Regards
> Hannes Hirzel
> 
> 
> P.S. I'll put the anser on the Project Swiki note page
> http://minnow.cc.gatech.edu/squeak/1817
> 
> 





More information about the Squeak-dev mailing list