Squeak Starter

Ian Piumarta ian.piumarta at inria.fr
Mon Sep 23 21:45:14 UTC 2002


On Sat, 21 Sep 2002, Radnour Acton-Page wrote:

> I Ihave just come across Squeak and like what I see. Up to a point the
> language is simple and very powerful and it beats the hell out of C++ , Java
> and the like. However, I find Morphic very confusing, are there any simple
> examples for me to follow ? I am looking at the 'press button, show mesage'
> level and upwarsd.

Open a system browser (from background menu).  This is the best tool from
which to snoop around.

In top-left pane, type "cmd-f" (or "alt-f") for "find class" (or choose it
from the menu icon in the scroll bar of that pane).

Type "button" into the pop-up, press return.

A list of buttonish classes pops up, amongst which figures
"SimpleButtonMorph".  Looks promising!  Select it.

Look at class side (for instantiation): #newWithLabel: -- this might just
be exactly what we wanted.

Open a workspace (b/g menu) to try it out.  In the workspace, type

  (SimpleButtonMorph newWithLabel: 'Hello, world') openInWorld

select it and choose "do it" (or "cmd-d").  Well, that's definititely a
button, but it doesn't do much.

Look in browser on instance side.  Hmm... #target:, #actionSelector:,
#arguments: -- those look quite promising.

Back to the workspace:

  (SimpleButtonMorph newWithLabel: 'Hello, world')
	target: Smalltalk;
	actionSelector: #confirm:;
	arguments: #('Boo!');
	openInWorld

Much more interesting!

Have fun making buttons.

Ian




More information about the Squeak-dev mailing list