Quit Squeak with code?

Ken Causey ken at kencausey.com
Fri Mar 3 18:41:45 UTC 2006


On Fri, 2006-03-03 at 14:26 +0100, Marcus Pedersén wrote:
> Hi!
> If I want to quit Squeak , for example have a "Quit button", how do I  
> do it with code instead of bringing worldmenu up?
> 
> Many thanks!
> Marcus

Let's do a little teaching to fish here. ;)

1.  Bring up the world menu.

2.  Bring up a halo by clicking on the 'quit' menu item in the world
menu with the appropriate button.  I believe this is the third mouse
button in general but you may have to experiment with this.  The halo is
a set of variously colored round buttons with icons that appears around
the Morph.

3.  Click once more on the 'quit' menu item with the same mouse button
which should 'shrink' the halo so it is only surround this specific item
in the menu.

4.  Left click the 'red' halo button in the upper left.  This will bring
up a menu.

5.  From this menu choose 'debug...' and then 'inspect morph' or
'explore morph'.  Either will work and is somewhat a matter of
preference.  I'm going to continue as if 'inspect morph' were selected.

6.  This brings up an inspector on the MenuItemMorph that represents the
'quit' selection from the World menu.  You can verify this by selecting
the 'contents' variable from the left pane.

7.  Now look at the target, selector, and arguments variables.  These
specify a message (selector) which is sent to a receiver (target) with
the specified arguments.

8.  If you open a browser and search for the TheWorldMenu class and look
at the instance side methods (the value of target is 'a TheWorldMenu')
and select 'doMenuItem:with:' from the list of methods (it happens to be
under the 'action' category) and examine it you will find that it sends
the message in the second position of the arguments Array to the
receiver in the first position.  The receiver is again 'a TheWorldMenu'
and the message is 'quitSession'.  You will find this in the 'commands'
category of the TheWorldMenu instance methods.

9.  From this point I think you can find your answer.

Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060303/a2066ec0/attachment.pgp


More information about the Squeak-dev mailing list