Being someone that is a purest at heart when it comes to separating business logic, i.e. the model, from its interface, i.e. a view and controller, here is an alternative to Tim's example. It's a little more work, but it keeps the LedMorph more of an "interface" object by making it pluggable. The counter object is a model object, and the counting application is a cooridnator object in that it creates the counter and pluggable led morph objects and connects them up.
It's not the best code in the world, but it gets the point across.
Mark
[Great Morphic example snipped]
Thanx Tim! This example really got me hooked into Morphic. Now, I would like to know:
If it is possible to construct the counter (one LedMorph, two SimpleButtomMorphs) without writing a single line of code, assuming that LedMorph already has "increment" and "decrement" menthods? I thought it was possible to do such a thing by creating the Led and buttoms from the "World>>new morph..." menu, and then sort of embed them to some AlignmentMorphs. But I couldn't figure a way out to do it.
Since I can store a morph to a file, how can I load a morph from file and give it a name?
Thanx!
Hsin-Hao Yu (Squeak newbie)
Attachment converted: Anon:Counting.st (TEXT/R*ch) (0001239C)