How do you make a Morph communicate with several other Morphs?

Alejandro F. Reimondo alereimondo at sugarweb.com
Wed Apr 29 19:42:33 UTC 1998


Philippe,

>How do you make a button Morph tell three StringMorphs to change their contents?
I think the problem is more deep.
For example:
    SimpleButtonMorphs are designed to have:
	a "target" an "actionSelector" and "arguments"
It invalidate the posibility to adapt it to diferent behaviour without subclassification.
I have encountered the same pattern in more places inside squeak and now i think we need "actions" as objects.
If an objects needs to do an action, it must contain anAction.
e.g.
aSimpleButtonMorph>>doButtonAction can simply do:
	^self action evaluate

and in Object we can implement:
evaluate
	^self

for Contexts:
evaluate
	^self value

for MessageActions:
evaluate
	^self receiver perform: self selector with: self arguments

and in Action we can implement the selector #, that returns an ActionSecuence
 (Action subclass: #ActionSecuence) that when evaluated perform evaluation of it childs.

You can find an implementation of Actions for Squeak at
	http://www.sugarWeb.com/Miniatures/downloads.html

hope this helps.
Ale.





More information about the Squeak-dev mailing list