[ENH] MorphMessageFix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ENH] MorphMessageFix

rhawley
from preamble:

"Change Set: MorphMessageFix
Date: 5 October 2006
Author: rhawley

First Matter
---------__--

Morphic scripts can send messages like forward: to Morphs, but
currently, if this is done as Smalltalk code it does not always work
because the morph needs to relay the command to its costume, but if the
costume does not yet exist it will need to be explicitely created.  The
separation of 'player' and 'costume' means that a morph cannot currently
directly respond to player messages; as the trick of trapping the
doesNotUnderstand: is already being used for morphic's tile based
scripts, it seems reasonable to use the same type of technique so that
we can write code that properly treats morphs as first class objects (as
they were intended to be).

So, with this fix we can straight forwardly do things like:

X := EllipseMorph new.
X openInWorld.
X lowerPen; turn: 135; forward: 500

Second Matter
----------------

The naming of Morphs is currently not fully developed or very convenient
to use.  The fix to the SimpleButtonMorph makes it possible to reference
a morph by using:
(World morphNamed: #Jim) forward: 99
assuming that you have bought up the halos and edited a morph's name to
be Jim. (This also makes use of the first fix to relay the forward:
message.)

 "
!



MorphMessageFix.cs.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ENH] MorphMessageFix

Noury Bouraqadi
Hi Bob,

Le 5 oct. 06 à 04:46, [hidden email] a écrit :

> Morphic scripts can send messages like forward: to Morphs, but
> currently, if this is done as Smalltalk code it does not always work
>
> [...]
>
> So, with this fix we can straight forwardly do things like:
>
> X := EllipseMorph new.
> X openInWorld.
> X lowerPen; turn: 135; forward: 500

Good idea. I like it!


> Second Matter
> ----------------
>
> The naming of Morphs is currently not fully developed or very  
> convenient
> to use.  The fix to the SimpleButtonMorph makes it possible to  
> reference
> a morph by using:
> (World morphNamed: #Jim) forward: 99
> assuming that you have bought up the halos and edited a morph's  
> name to
> be Jim. (This also makes use of the first fix to relay the forward:
> message.)
>

So, basically you're using the exernalName, which is the most natural.
BTW, I'm wondering why morphs have two names?

Noury
------------------------------------------------------------------
Dr. Noury Bouraqadi - Enseignant/Chercheur
ARMINES - Ecole des Mines de Douai - Dept. I.A.
http://csl.ensm-douai.fr/noury

European Smalltalk Users Group Board
http://www.esug.org

Squeak: a Free Smalltalk
http://www.squeak.org
------------------------------------------------------------------