dependency mechanism, and other questions

Ned Konz ned at bike-nomad.com
Sun Nov 19 22:16:26 UTC 2000


"Daniel, Sofie and Beatrice" wrote:
> 
> Can anyone help me with this?
> 
> I was playing with the LED counter morph class, and trying to work out how
> it updated its screen display. I figured that 'self changed' was doing it,
> but when I did:
> 
> display dependents
> 
> in the workspace, the answer was an empty array. How can the change method
> work if the dependents list is empty?

Because Morph>>changed doesn't do the same thing that Object>>changed does.
Look at the code. Morph>>changed just invalidates the rectangle, causing it
to be asked to redraw itself.

This probably will cause a model to be queried for its current state.

> .. but then where does Morphic fit in? To me it looks like this blurs all
> three back into one big ball again. I guess you would still model the
> problem seperately when appropriate, but it seems possible to build simple
> apps where the UI actually _is_ the model ...

Yes, that's the way it seems to be done.

There are a couple of design patterns in Morphic that work differently. There
are the Pluggable*Morph classes that actually get changed notifications and
go out to a model for the info they need to display themselves.

Then there are a number of Morphic classes that hold on to their own model
(or _are_ their own model), and ask that model for its current state
during their step or draw methods.

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





More information about the Squeak-dev mailing list