[Q] changed: update: for morphs

Ned Konz ned at bike-nomad.com
Thu Mar 28 20:06:11 UTC 2002


On Wednesday 27 March 2002 07:38 am, Martin Drautzburg wrote:
> No View superclass for morphs

>         There are Classes like PluggableListView that inherit from
>         View. Still understandable. But there is also a
>         PluggableListMorph, that inherits from Morph. But Morph does
>         not implement an update: method and with single inheritance I
>         cannot additionally inherit from View. So how does a Model
>         inform a Morph about changes ? Do I just roll my own update:
>         Method for the morph ?

The Pluggable* classes were (AFAICT) designed to port the MVC programming 
tools over to Morphic. So a parallel set of view objects were developed that 
could be connected to the same models (browsers, etc.)

All of the Pluggable*Morphs and all of the Pluggable*Views implement update:

Morph itself doesn't need to implement update: in general. If you want to use 
the MVC pattern with Morphs and models you build, just add an update: method 
to the Morphs.

Or you can use the more powerful and lighter weight event notification scheme 
that is accessed with #when:send:to: and #trigger and their friends. (The 
#trigger methods are changing names in 3.2 soon, and have already in 3.3). 
These let you connect events to actions without the target object (the View, 
in MVC terms) having to provide any code to handle the events (no update: 
methods required).

There is another mechanism that is used in Morph for updating; this is the 
#step method. Your Morph can have its step method called periodically and can 
do whatever is necessary to update itself. This may be more appropriate for 
some uses.


-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list