Exit loop

Bert Freudenberg bert at freudenbergs.de
Mon Oct 8 07:54:40 UTC 2007


On Oct 8, 2007, at 0:30 , Javier Reyes wrote:

> Hello All,
>
> I am trying to create a button or morph that when pressed stores  
> the present Squeak image and exits Squeak. I have tried both with a  
> PluggableButtonMorph with its action associated and with a plain  
> rectangleMorph defining its mouseDown method as follows:
>
> mouseDown: anEvent
> SmalltalkImage current saveImageInFileNamed: (SmalltalkImage  
> current imageName).
> Smalltalk quitPrimitive.
>
>
> In both cases pressing the morph performs as expected, but when I  
> try to launch that image back and the application with it, it seems  
> to be looped into that event again exiting immediately.
>
> I know I am missing something important.  Could someone explain me  
> what it is ?

Sure.  "Saving" an image means simply to stop time. So time stops  
"inside" of #saveImageInFileNamed:, and when you resume the image,  
the first thing it executes is ... quitPrimitive. That's why we have  
that method that does both: #snapshot:andQuit:.

- Bert -





More information about the Squeak-dev mailing list