Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Layout of a simple table
Last updated at 8:50 pm UTC on 7 May 2018

 | parent1Side cellSide cell |
 
  parent1Side := 320.
  cellSide := 50.
 
  parent1 := Morph new.
  parent1 width: parent1Side.
  parent1 height: parent1Side.
  parent1 color: Color white.
 
  parent1 layoutPolicy: TableLayout new.
  parent1 listDirection: #leftToRight.
  parent1 wrapCentering: #topLeft.
  parent1 wrapDirection: #topToBottom.
 
  parent1 layoutInset: 18@18.
  parent1 cellInset: 8@8.
  
  1 to: 25 do:  [:i |  cell := EllipseMorph new. 
                    cell height: cellSide. cell width: cellSide.
                    cell color: Color random twiceLighter twiceLighter twiceLighter. 
                    cell borderWidth: 0.
                    parent1 addMorphBack: cell
                  ].
 
  parent1 openInWorld.

TableLayout_simple.png



Adapted from MorphLayoutArticle, first exercise.
MorphLayoutArticle_a_simple_table.png