No class LayoutManager but LayoutPolicy
Last updated at 4:50 pm UTC on 24 November 2020
There is no class called 'LayoutManager' in Squeak. Layout management is done by assigning a LayoutPolicy to a Morph object.
A morph acts makes the submorphs to appear in a row.
row := Morph new.
row layoutPolicy: TableLayout new.
row listDirection: #leftToRight.
row hResizing: #shrinkWrap.
row vResizing: #shrinkWrap.
"The row morph object is now doing layout management of its submorphs"
width:= 100. height := 50.
row addMorphBack: (Morph new color: Color red; extent: width@height).
row addMorphBack: (Morph new color: Color green; extent: (width * 1.5)@height).
row addMorphBack: (Morph new color: Color blue; extent: (width * 2)@height).
row extent 450@50
A more complex example which makes use of the code above:
Multiplication table (TableLayout example)