To me, the first obvious question would be: Why do you want purple
to be a submorph of main
? Grouping morphs based on common properties usually helps organizing and layouting them. In general, it's a widespread practice in Morphic to use composition extensively.
Preliminary note: As you did not provide a code sample, I will work with the following baseline script:
main := Morph new
color: Color cyan;
borderWidth: 2;
borderColor: Color black.
main
changeTableLayout;
listDirection: #leftToRight;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
cellGap: 5.
main addAllMorphs:
{Morph new color: Color red; borderWidth: 2; borderColor: Color black.
Morph new color: Color green; borderWidth: 2; borderColor: Color black.
Morph new color: Color blue; borderWidth: 2; borderColor: Color black}.
purple := Morph new color: Color magenta.
main openInWorld.
purple openInWorld.
purple topLeft: main bottomLeft.
Solution 1: Composition
If you use composition, you can arrange both main
and purple
in another table-layouted transparent container:
outer := Morph new
changeTableLayout;
beTransparent;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
cellPositioning: #topLeft;
yourself.
outer addAllMorphs: {main. purple}.
outer openInWorld.

Solution 2: Exclude single morph from its owner layout policy
Just for sake of completion, it is also possible to exclude a single morph from its owner layout policy as you requested. This can be done by enabling the #disableLayout
property on the relevant submorph:
purple disableLayout: true.
main vResizing: #rigid; height: 44.
main addMorph: purple.
purple topLeft: main bottomLeft.

However, I would not consider this solution idiomatic in most situations:
- You are foregoing composition (as described above) which increases the overall layout complexity.
- You are deliberately positioning a morph outside of the bounds of this owner. While Morphic generally supports this (see
#fullBounds
), this is often unexpected and may make certain inspection and debugging tasks harder. For instance, to invoke a halo on the purple morph in this example, you need to either press Shift + Blue, or turn on the preference "Halo encloses full bounds". Note that since Squeak 6.0, you can also press Ctrl + Blue to override this preference once.