Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TwoWayScrollPane
Last updated at 9:00 pm UTC on 27 October 2004
Example:

 rectMorph := RectangleMorph new extent: 1000@500.
 rectMorph layoutPolicy: TableLayout new.
 rectMorph listDirection: #leftToRight.
 rectMorph wrapCentering: #topLeft.
 rectMorph wrapDirection: #topToBottom.
 
 scrollPane := rectMorph inATwoWayScrollPane.
 swin := SystemWindow new paneColor: (Color brown twiceLighter).
 swin setLabel: 'Ellipses in a TwoWayScrollPane'.
 swin addMorph: scrollPane frame: (0@0 extent: 1@1).
 swin openInWorld.
 
 100 timesRepeat: [ e _ EllipseMorph new color: Color random.
 			       e width: 80. e height: 50.
                              rectMorph addMorphBack: e ].
 
 scrollPane fitContents.

adapted from T. Scott Saponas http://coweb.cc.gatech.edu/cs2340/2777

Question: May 17, 2004 I want to add some Morphs to a scrollPane such that the Morph is not visible and the ScrollPane becomes scrollabe if the Morph is outside the (at the moment)visible range of the ScrollPane. How can I do this?

Answer: Hernan Tylim Try the following code on a workspace:
| s |
s _ ScrollPane new.
y _ 0.
4 timesRepeat: 
 [s scroller addMorph: (BorderedMorph new position: 0@y).
 y _ y + 50].
s scroller color: Color white.
s
 extent: 100@100; 
 openInWorld
As you see the contents of a ScrollPane are placed in its scroller submorph.
Answer:Ned Konz You can have some morph (perhaps the scroll pane?) with behavior such that when it is scrolled or resized (or its children are moved) it hides or shows the scroll bar.