Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Example of flow layout using TableLayout
Last updated at 12:38 pm UTC on 18 November 2015
The following example shows how the TableLayout policy may be used to produce a Java FlowLayout manager like effect

MorphicLayout6217_FlowLayoutLike_2015-10-31.png

 | 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
                 ].

 cont openInWorld.

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.