[Newbies] Morphic Questions

Bert Freudenberg bert at freudenbergs.de
Fri Feb 15 09:35:39 UTC 2008

On Feb 15, 2008, at 9:55 , Michael van der Gulik wrote:

>> There seem to be at least 2 ways to handle messages with Morphic.   
>> The
>> subclassing way, overriding methods such as *handlesMouseDown* and so
>> on, and *on:send:to:* way.  What are the differences between the two,
>> and why would I prefer one over the other?
> Unless you come across problems, either way is good.
> A quick look at the code shows that if you override methods, you'll be
> overriding the implementation used by on:send:to to implement message
> sending. It seems your implementation would run faster if you override
> the methods.
> You might want to use on:send:to if you want your event handling logic
> to be in another object.

Typically you would only subclass if you create a new "kind" of  
morph. When you assemble a UI from existing morphs, you would use the  
event handlers.

>> 2. MorphicModel
>> The MorphicModel class appears to be for morphs that implement the
>> view side of MVC.  However, I find the source rather confusing.  What
>> on earth is a *slotSelector*, for instance?  And a method like
>> *compileAccessForSlot* just leaves me baffled.  What is this class
>> for, and are there any simple examples of its use?
> Welcome to Squeak. You might find a lot of the source quite confusing;
> there are a lot of ancient relics, failed experiments and red herrings
> in the image. Just try to understand only as much as you need;  
> trying to
> understand more will leave you either confused or disgusted.
> Note firstly that MorphicModel is a superclass of a whole host of  
> other
> classes - open up the hierarchy browser and see! I believe it  
> represents
> to some degree the "model" of the model-view-controller paradigm that
> Morphic was written to be so blissfully unaware of.
> As with a slot - never heard of them, and the source code is pretty
> non-obvious. It messes with reflection, so it's probably dodgy code.

Looks like the relict of a former UI builder.

>> 3. PasteUpMorph
>> I know that the screen background is a PasteUpMorph, but I see them
>> mentioned elsewhere from time to time.  What exactly is a
>> PasteUpMorph?  Would I ever want to use one?  Is there a simple  
>> example?
> The PasteUpMorph class in Squeak 3.9 has a pretty good description.  
> Try
> this:
> PasteUpMorph newWorldTesting

PasteUpMorphs are typically only used in Etoys (except for the World  
of course).

- Bert -

> Often you'll find test methods on the class side. These can be useful
> for just playing with the code to see what it does. The BitBlt class
> tends to be pretty fascinating in this regard :-).
> Also, again, look at the inheritance hierarchy (the "hierarchy" button
> in the browser) and you'll see its the superclass of a bunch of other
> interesting looking classes.
> Don't forget to visit us on IRC at #squeak. It's often quiet for long
> periods, but people do come and go and we like newbies there.
> Cheers,
> Gulik

More information about the Beginners mailing list