[Newbies] Morphic layout: Proportional centering of cells

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Sep 6 13:22:17 UTC 2019


I am probably not seeing the wood for the trees: How can I achieve the following situation? When the layout changes, both texts should keep their center relative to their owner's bounds:


If I use a ProportionalLayout, I can position the TextMorphs at the offsets 0.5 at 0.25 and 0.5 at 0.75, but only with their upper left corner, so they will not really be centered.

If I use a TableLayout, I can center the TextMorphs at the top and the bottom using #listCentering:. However, I cannot center each morph relative to one vertical halft of the owner.

How can I stretch both cells to half the height of the morph? I also experimented with #cellSpacing: but still did not achieve the desired layout. (Also, I did not found any senders of the property in the image.)

Of course, I could use two auxiliary morphs which are arranged using a ProportionalLayout and each contain one text as a centered cell (with #listCentering: and #wrapCentering:). But for me, this feels a quite heavy solution for such a simple problem. Or is this the only way to go?

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190906/55d741e3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 5762 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190906/55d741e3/attachment.png>

More information about the Beginners mailing list