example7: flow layout implemented with a TableLayout
Last updated at 8:47 am UTC on 10 August 2020
The following example shows how the TableLayout policy may be used to produce a Java FlowLayout manager like effect
| cont |
cont := Morph new.
cont width: 200.
cont height: 150.
cont layoutPolicy: TableLayout new.
cont listDirection: #leftToRight.
cont wrapCentering: #topLeft.
cont wrapDirection: #topToBottom.
20 timesRepeat: [ m:= Morph new.
m height: 25.
m color: Color random.
m width: m width + 20 atRandom - 10.
cont addMorph: m
Try changing some of the symbols above to see the effects, if any.
You can interactively meddle with the morph by opening its menu, finding the layout->table layout-> submenus and playing.
See also TableLayoutExample with 100 squares