The Mystery of the Morph
Trygve Reenskaug
trygver at ifi.uio.no
Sat Feb 14 11:15:15 UTC 2004
Image: 3.6-5429-full
On page http://minnow.cc.gatech.edu/squeak/52 , Hannes Hirzel has a very
good and very simple example of the layout of Morphs as follows:
------------------------------
m := RectangleMorph new.
m layoutPolicy: TableLayout new.
m listDirection: #leftToRight. "If you omit this expression you get the
default "
"m listDirection: #topToBottom."
m hResizing: #shrinkWrap.
m vResizing: #shrinkWrap.
m addMorph: (EllipseMorph new extent: 40 at 40; color: Color red).
m addMorph: (EllipseMorph new extent: 50 at 50; color: Color yellow).
m addMorph: (EllipseMorph new extent: 60 at 60; color: Color green).
m addMorph: (EllipseMorph new extent: 70 at 70; color: Color blue).
m openInWorld.
You can change anytime between:
m listDirection: #leftToRight.
and
m listDirection: #topToBottom.
------------------------------------
It works! It's simple, it's elegant, it's beautiful.
Now continue with one of these at the time:
m listDirection: #leftToRight.
m listDirection: #topToBottom.
m listDirection: #leftToRight.
It still works. Now do
m listDirection: #topToBottom.
m listDirection: #rightToLeft.
WE NOW HAVE THREE CIRCLES STACKED ON TOP OF EACH ORDER WITHIN A SQUARE!!!
I must be missing something. But what?
In confusion
--Trygve
--
Trygve Reenskaug mailto: trygver at ifi.uio.no
Morgedalsvn. 5A http://heim.ifi.uio.no/~trygver
N-0378 Oslo Tel: (+47) 22 49 57 27
Norway
More information about the Squeak-dev
mailing list
|