[squeak-dev] Re: Layout policy ignored for morphs w/o submorphs... ?

Marcel Taeumel marcel.taeumel at student.hpi.uni-potsdam.de
Wed Jan 21 16:12:44 UTC 2015


After a small discussion with Bert, I realized that you normally do layouting
*only* for your submorphs. This is fine for #rigid and #spaceFill behavior
because you need your owner's data to layout. However, #shrinkWrap, as it is
currently implemented in a similar way, has nothing to do with your owner.

I vote for being able to implement #shrinkWrap behavior in your own layout
policy:

| shrinkWrappedMorph |
shrinkWrappedMorph := Morph new layoutPolicy: ShrinkWrapLayout new.
shrinkWrappedMorph addMorph: Morph new.
shrinkWrappedMorph addMorph: Morph new.
shrinkWrappedMorph addMorph: Morph new.
self assert: shrinkWrappedMorph fullBounds = shrinkWrappedMorph
submorphBounds.

As for now, this would be against the concept of layout policies and how
they are implemented in Morph. We should anticipate such behavior and thus
allow policies to work -- even w/o any submorph present.

As I look through TableLayout >> #layoutTopToBottom:in:, this is already
happening:

| shrinkWrappedMorph |
shrinkWrappedMorph := Morph new layoutPolicy: TableLayout new.
shrinkWrappedMorph vResizing: #shrinkWrap; hResizing: #shrinkWrap.
shrinkWrappedMorph addMorph: Morph new.
shrinkWrappedMorph addMorph: Morph new.
shrinkWrappedMorph addMorph: Morph new.
self assert: shrinkWrappedMorph fullBounds = shrinkWrappedMorph
submorphBounds.

You don't need a parent with a layout policy that realizes your
shrinkWrap-behavior. Thus, there is no reason for a morph to prevent a
policy from working when there is no submorph present.

Best,
Marcel



--
View this message in context: http://forum.world.st/Layout-policy-ignored-for-morphs-w-o-submorphs-tp4800819p4800821.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list