Morphic Docs on swiki
lex at cc.gatech.edu
Sun Mar 19 17:49:27 UTC 2000
Russell Swan <swan at dandenong.cs.umass.edu> wrote:
> Thanks very much for the Morphic Tutorial.. They are very informative and
> its great to get some documentation on Morphic. There are some parts of
> Morphic that I am quite fuzzy about, and I hope you address these in later
> Specifically, I'm confused about models in Morphic. My understanding of
> models in Smalltalk and MVC is that a model contains the logic of the
> application and is kept separate from the interface. Interface elements
> are registered with a model by sending them the #model: message. Models
> communicate by sending themselves the #changed message, which causes an
> #update: message to get sent to every dependent.
There's how things work, and there's philosophy. Most of this is about
philosophy, and can apply fine in most any graphics system. Morphic
itself is just a hunk of code and doesn't really enforce much
philosophy. (a little, but not a lot)
Given that, here is one way to apply MVC to Morphic. A Morph is the
view and control, bundled together. A Morph does not *have* to have a
model associated with it, but can instead just sit there and do stuff
all by itself.
Then again, a Morph certainly *can* have a model with it. The
PluggableMorph's (Text, List, Button), for example, all have an explicit
model. The model is queried for things like the text to display, or the
list of items to display. Furthermore, the model is informed in the
user has changed and accepted some text, or if they have selected a
different item from a list. It works just like the books describe,
except that the code to initially build a morph is different from that
to build a View in the ST-80 framework.
So that's the overview. It suggests that anyone who wants to just make
some basic GUI's, should probably look at PluggableTextMorph,
PluggableListMorph, and PluggableButtonMorph. Given these basic
components, you can program in a MVC style just fine, and you don't have
to get into the nuts and bolts of how Morphic works. Furthermore, your
app will likely port to the old ST-80 graphics system (also misnamed
"MVC") very easily.
It's only if you want to make some new kind of graphic widgit, that you
need to worry about how Morphic works. But in that case, you can choose
whether or not the MVC paradigm is relevant.
More information about the Squeak-dev