Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Recipe: Create a window with scrollable contents - example 4
Last updated at 2:48 am UTC on 25 August 2019
from: http://stackoverflow.com/questions/34722545/how-to-make-a-scrollpane-adjust-to-its-content


 | rows sp |
 rows := Morph new
 layoutPolicy: TableLayout new;
 listDirection: #topToBottom;
 color: Color white.
 sp := ScrollPane new extent: 240@100.
 sp scroller addMorph: rows.

 rows addMorphBack: (RectangleMorph new color: Color red).
 rows addMorphBack: (RectangleMorph new color: Color blue).
 sp openInWindow.

 rows addMorphBack: (RectangleMorph new color: Color green).
 rows addMorphBack: (RectangleMorph new color: Color yellow).
 rows addMorphBack: (RectangleMorph new color: Color black).
 rows addMorphBack: (RectangleMorph new color: Color white).

 sp setScrollDeltas.


ScrollPane.png
The diagram below is an SRE collaboration diagram.
ObjectCollaboration_SystemWindow_ScrollPane_TransformMorph.png