<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Thank you for your answer.</p>
<p><br>
</p>
<p>Actually, I chose TextMorphs as an example for a non-scalable morph. It is interesting to hear that SimpleButtons center themselves, but how could I achieve the same for, let me say, two ImageMorphs?</p>
<p><br>
</p>
<p><img size="3785" contenttype="image/png" id="img640548" style="max-width: 99.9%; user-select: none;" contextid="img550848" tabindex="0" src="cid:536e67a6-33b4-49ee-9d61-fb5f6cb1a90b"><br>
</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Nicola Mingotti <nmingotti@gmail.com><br>
<b>Gesendet:</b> Samstag, 7. September 2019 00:24:16<br>
<b>An:</b> A friendly place to get answers to even the most basic questions about Squeak.; Thiede, Christoph<br>
<b>Betreff:</b> Re: [Newbies] Morphic layout: Proportional centering of cells</font>
<div> </div>
</div>
<div><br>
I guess you are looking from something like this: <br>
<br>
note: the ButtonMorph is the only one that by default put the<br>
text in center of its geometry. StringM and TextM do not.<br>
<br>
========================<br>
<br>
m := RectangleMorph new.<br>
m openInWorld.<br>
m extent: 300@300; position: 100@100.<br>
<br>
m layoutPolicy: TableLayout new.<br>
m listDirection: #topToBottom.   "default, place elements as rows in a table."<br>
m listCentering: #topLeft. <br>
m layoutInset: 5.   "space to container morph."<br>
m cellInset: 5@5. "Space between table cells."<br>
m hResizing: #spaceFill. <br>
m vResizing: #spaceFill.<br>
m color: (Color yellow darker darker darker).<br>
<br>
t1 := SimpleButtonMorph new.<br>
t1 openInWorld. <br>
t1 color: ((Color green) lighter lighter lighter) .<br>
t1 borderColor: (Color black). <br>
t1 borderWidth: 2.<br>
t1 hResizing: #spaceFill.<br>
t1 vResizing: #spaceFill.<br>
m addMorphBack: t1.<br>
<br>
t2 := SimpleButtonMorph new. <br>
t2 openInWorld. <br>
t2 color: ((Color yellow) lighter lighter lighter) .<br>
t2 borderColor: (Color black). <br>
t2 borderWidth: 2.<br>
t2 hResizing: #spaceFill.<br>
t2 vResizing: #spaceFill.<br>
m addMorphBack: t2.<br>
<br>
========================<br>
<br>
<br>
<div class="moz-cite-prefix">On 9/6/19 6:22 AM, Thiede, Christoph wrote:<br>
</div>
<blockquote type="cite" cite="mid:c4bba99decfa4922a89bb641e2e7ea23@student.hpi.uni-potsdam.de">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt;
        color: rgb(0, 0, 0); font-family: Calibri, Helvetica,
        sans-serif, EmojiFont, "Apple Color Emoji",
        "Segoe UI Emoji", NotoColorEmoji, "Segoe UI
        Symbol", "Android Emoji", EmojiSymbols;">
<p>Hi,</p>
<p><br>
</p>
<p>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:</p>
<p><br>
</p>
<p><img naturalheight="372" naturalwidth="379" size="5762" id="img271117" tabindex="0" style="max-width: 99.9%;
            user-select: none;" class="" src="cid:part1.C7592CF9.AA979317@gmail.com"><br>
</p>
<p><br>
</p>
<p>If I use a ProportionalLayout, I can position the TextMorphs at the offsets <a class="moz-txt-link-abbreviated" href="mailto:0.5@0.25">
0.5@0.25</a> and <a class="moz-txt-link-abbreviated" href="mailto:0.5@0.75">0.5@0.75</a>, but only with their upper left corner, so they will not really be centered.</p>
<p>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.</p>
<p>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.)</p>
<p><br>
</p>
<p>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?</p>
<p><br>
</p>
<p>Thanks in advance,</p>
<p>Christoph</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/mailman/listinfo/beginners">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</div>
</body>
</html>