Mantis - Squeak
Viewing Issue Advanced Details
5201 Morphic major N/A 10-08-06 21:29 10-09-06 02:33
new 3.9  
0005201: Appropriate relay of messages from the morph to its costume (+ derivative improvements)
Currently the following does not work (when reasonably it should):
   EllipseMorph new openInWorld; lowerPen; turn: 135; forward: 500
The first fix given in the attached changes file fixes this by relaying messages to the morph's player.

This is a major fix that will make it much easier to drive morphs using direct Smalltalk code - a bonus for the initial teaching of Smalltalk. (It makes coding consistent with using the EToys scripting tiles).

The second fix in the attached file allows morphs to be accessed using their names. E.g. :
  (World morphNamed: #Star) forward: 99
This is useful for the "Press Me" button - this fix is used to allow the name to be specified in the Target field of a button.
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

Testing: An example Morph that makes very good use of the relaying works well. The main effect is to ensure that the morph's player exists, so the scripting system is not effected by this change.

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.)

Testing: This has worked with several examples. The fix tests for flaps so that it can ignore them - because flaps of the same name as a morph are created. If there is more than one morph of the same name, it is essentially arbitary as to which gets chosen. There may be possible future improvements, but the fix works as intended so far.

10-08-06 21:42   
Sorry - finger trouble - submitted this twice.
10-09-06 02:33   
see 0005202 for the main thread of this. this is the incomplete duplicate.
10-09-06 02:33   
see 0005202 for the main thread of this. this is the incomplete duplicate.