Hi Sean.

By "accurately" I mean without any added extra space around the contents.

You should use #scrollTarget: to set the content of the scroll pane as a whole (the default content is the blue morph you mention).

E.g.

|work scroll|
work := self newWorkAreaMorph.
scroll := GeneralScrollPane new
 borderWidth: 0;
 color: Color transparent;
 hResizing: #spaceFill; vResizing: #spaceFill.
scroll
 scrollTarget: work;
 on: #mouseDown send: #selectByHandFromScroller: to: self page.


Or, assuming is in Pharo 2.0/3.0, the builder method.

scroller := UITheme builder newScrollPaneFor: self newSettingsGroup.
scroller
 fillStyle: scroller scrollTarget fillStyle;
 changeScrollerTableLayout;
 vResizing: #spaceFill;
 hResizing: #shrinkWrap.


Regards, Gary

----- Original Message ----- From: "Sean P. DeNigris" <[email protected]>
To: <[email protected]>
Sent: Friday, February 14, 2014 1:25 AM
Subject: [Pharo-dev] ScrollPane vs. GeneralScrollPane


GeneralScrollPane's class comment says "A scroll pane that handles its
contents accurately". As opposed to what? Was it intended as a replacement
for ScrollPane, or does it cover a different case?

Also, the examples show scrolling a single Morph that is too big for the
container, which is easy, but for a list requires creating an extra morph
(not a big deal). "GeneralScrollPane new scroller" returns a
TransformWithLayoutMorph, which is "A transform morph that allows the use of a layout policy to arrange submorphs". That sounds like I could do something
like:
s := GeneralScrollPane new.
s scroller changeTableLayout.
(1 to: 50) do: [ :e | s scroller addMorphBack: (SimpleObjectMorph on: e ) ].
s openInWindow.

Although it lays out the object morphs vertically in the scroll pane, there is a blue morph above them and the scroll bars only appear when the pane is
smaller than this morph.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/ScrollPane-vs-GeneralScrollPane-tp4743443.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.



Reply via email to