<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">El 13/3/23 a las 20:29, Alexandre
      Rousseau escribió:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKmOay+kF=s7ZbiaeQ+pgAb0XnMb3BL0aq+3aWOdLXp6-zbyAA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Hilaire and Mariano,
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Most
          of the time, you don't need to subclass LayoutMorph, unless
          you want to define new sort of complex widget.</blockquote>
        <div><br>
        </div>
        <div>What distinguishes a complex widget from their
          counterparts? In my case, here is a screenshot of work in
          progress... a sampling of widgets placed on a PasteUpMorph
          instance. Each of those widgets extends LayoutMorph class. I
          could have had them be a subclass of BoxedMorph (or
          placedMorph) but, given that the widgets I want to use all lay
          out their components in vertical order, I thought extending
          LayoutMorph made more sense. If not, then I would have to
          embed a layout morph as top level submorph in each of them,
          then embedding further submorphs inside of that.</div>
      </div>
    </blockquote>
    <p>Yes that's fine way of doing it.</p>
    <p>About the #beColumn initialization, this is the implementation:</p>
    <p>beColumn<br>
          "Establish the major layout axis, with default edge weight" <br>
      <br>
          direction := #vertical.<br>
          axisEdgeWeight ifNil: [self axisEdgeWeight: #center].<br>
          self layoutSubmorphs.</p>
    <p><br>
    </p>
    <p>It sets parameters and calls #layoutSubmorphs.<br>
    </p>
    <p>So, the issue in your initialization method was that you were
      calling #beColumn before adding the submorphs, and
      #layoutSubmorphs was not called after that, so there's no effect
      in layout.</p>
    <p><br>
    </p>
    <p>     Mariano<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CAKmOay+kF=s7ZbiaeQ+pgAb0XnMb3BL0aq+3aWOdLXp6-zbyAA@mail.gmail.com">
      <div dir="ltr">
        <div><br>
        </div>
        <div>So, if I gather correctly, the following would be more
          idiomatic. Please correct me if I'm wrong (and thanks again!)
          :</div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font
            face="monospace">initialize<br>
            | lo |<br>
              super initialize.<br>
              lo LayoutMorph newColumn.<br>
              lo<br>
                addMorph: (BoxedMorph new color: Color red; yourself);<br>
          </font><span style="font-family:monospace">    </span><font
            face="monospace">addMorph: (BoxedMorph new color: Color
            green; yourself);<br>
          </font><span style="font-family:monospace">    </span><font
            face="monospace">addMorph: (BoxedMorph new color: Color
            blue; yourself).<br>
              self addMorph: lo.<br>
              self morphExtent: `40@120`.</font></blockquote>
        <div><br>
        </div>
        <div>A.</div>
        <div><img src="cid:part1.QR7Qpy9s.z7tQ0xe6@gmail.com"
            alt="Screenshot 2023-03-13 at 7.28.53 PM.png" class=""
            width="556" height="438"><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, Mar 13, 2023 at
          6:53 PM Mariano Montone <<a
            href="mailto:marianomontone@gmail.com"
            moz-do-not-send="true" class="moz-txt-link-freetext">marianomontone@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <div>I got it wrong. Seems that row layout layouts things
              horizontally, and column vertically.</div>
            <div><br>
            </div>
            <div>As Hilaire mentioned, unless you want to define your
              own layout algorithm, the idea is to use the layout
              morphs, not subclass from them.</div>
            <div><br>
            </div>
            <div>Layouts in a column (vertically):</div>
            <div> <br>
            </div>
            <div>LayoutMorph newColumn ::<br>
                      addMorph: (BoxedMorph new color: Color red;
              yourself);<br>
                      addMorph: (BoxedMorph new color: Color green;
              yourself);<br>
                      addMorph: (BoxedMorph new color: Color blue;
              yourself);<br>
                      openInWorld.<br>
            </div>
            <div><br>
            </div>
            <div>Layouts in a row (horizontally):<br>
            </div>
            <div> LayoutMorph newRow ::<br>
                      addMorph: (BoxedMorph new color: Color red;
              yourself);<br>
                      addMorph: (BoxedMorph new color: Color green;
              yourself);<br>
                      addMorph: (BoxedMorph new color: Color blue;
              yourself);<br>
                      openInWorld.</div>
            <div><br>
            </div>
            <div>    Mariano</div>
            <div><br>
            </div>
            <div>El 13/3/23 a las 18:30, Alexandre Rousseau escribió:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">You may want to try
                  with #beRow if you want submorphs to align vertically
                  (in rows).</blockquote>
                <div><br>
                </div>
                Hmm... I'm not sure about this.
                <div><br>
                </div>
                <div>I've attached the filed-out test class to this
                  email, if you want to take a closer look.</div>
                <div><br>
                </div>
                <div>Basically it is a LayoutMorph subclass, initialized
                  as:
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">initialize<br>
                    | b1 b2 b3 |</blockquote>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">super initialize.<br>
                    self beRow.<br>
                    b1 BoxedMorph new :: color: Color red.<br>
                    b2 BoxedMorph new :: color: Color green.<br>
                    b3 BoxedMorph new :: color: Color blue.<br>
                    self addMorph: b1.<br>
                    self addMorph: b2.<br>
                    self addMorph: b3.<br>
                    self morphExtent: self minimumExtent.</blockquote>
                  <div>and the instantiation of which results in this
                    (attached image 1).</div>
                  <div><br>
                  </div>
                  <img src="cid:part2.0keuDV7k.9O1E9Cn8@gmail.com"
                    alt="image1.png" class="" width="152" height="50"><br>
                  <img src="cid:part3.zdEGotTj.03Q4Z3RX@gmail.com"
                    alt="image 2.png" class="" width="194" height="162"><br>
                  <div>Changing line 4 to "self beColumn" does not lay
                    the items out vertically. See attached image 2.</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Mon, Mar 13, 2023
                  at 4:01 PM marianomontone--- via Cuis-dev <<a
                    href="mailto:cuis-dev@lists.cuis.st" target="_blank"
                    moz-do-not-send="true" class="moz-txt-link-freetext">cuis-dev@lists.cuis.st</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">On 13/3/23 13:36,
                  Alexandre Rousseau via Cuis-dev <<a
                    href="mailto:cuis-dev@lists.cuis.st" target="_blank"
                    moz-do-not-send="true" class="moz-txt-link-freetext">cuis-dev@lists.cuis.st</a>>
                  wrote:<br>
                  > Defining a class as subclass of LayoutMorph and
                  initializing it thus:<br>
                  > <br>
                  >     initialize<br>
                  >        super initialize.<br>
                  >        self beColumn.<br>
                  > <br>
                  > <br>
                  > morphs added to it still appear next to each
                  other, horizontally, as if <br>
                  > #beColumn was ignored.<br>
                  > <br>
                  > Is this expected behaviour for a subclass of
                  LayoutMorph?<br>
                  <br>
                  I think it is. You may want to try with #beRow if you
                  want submorphs to align vertically (in rows).<br>
                  <br>
                        Mariano<br>
                  -- <br>
                  Cuis-dev mailing list<br>
                  <a href="mailto:Cuis-dev@lists.cuis.st"
                    target="_blank" moz-do-not-send="true"
                    class="moz-txt-link-freetext">Cuis-dev@lists.cuis.st</a><br>
                  <a
                    href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
                </blockquote>
              </div>
            </blockquote>
            <p><br>
            </p>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>