ScrollPane design question was: Speaking of the latest
version...
Bob Arning
arning at charm.net
Thu Jul 1 15:33:22 UTC 1999
On Sat, 26 Jun 1999 17:37:19 -0600 David Farber <dfarber at numenor.com> wrote:
>so, i "fixed" both of these problems by rewriting addMorph: in ScrollPane to
>add new morphs to the scroller and then update itself. (i also had to make
>changes to initialize.)
>
>and it was Good.
>
>until, in the course...
David,
I wonder if it might be better not to rely on #addMorph: and its variants for the purpose of putting morphs into some sort of scrolling container. Perhaps a different protocol would make the intention clearer and avoid changing behavior that may be needed elsewhere. Enclosed is a small sample. File it in and evaluate "GenericScrollPane test".
Cheers,
Bob
'From Squeak 2.3 of January 14, 1999 on 1 July 1999 at 11:21:48 am'!
ScrollPane subclass: #GenericScrollPane
instanceVariableNames: 'scrollingMorphHolder '
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Windows'!
!GenericScrollPane methodsFor: 'as yet unclassified' stamp: 'RAA 7/1/1999 11:14'!
addScrollingMorph: aMorph
scrollingMorphHolder addMorphBack: (
AlignmentMorph newRow
color: Color transparent;
addMorph: aMorph
).
! !
!GenericScrollPane methodsFor: 'as yet unclassified' stamp: 'RAA 7/1/1999 11:14'!
initialize
super initialize.
scroller addMorph: (
scrollingMorphHolder _ AlignmentMorph newColumn color: Color transparent
).
! !
!GenericScrollPane methodsFor: 'as yet unclassified' stamp: 'RAA 7/1/1999 11:01'!
layoutChanged
super layoutChanged.
self resizeScrollBar; resizeScroller; setScrollDeltas
! !
!GenericScrollPane class methodsFor: 'as yet unclassified' stamp: 'RAA 7/1/1999 11:21'!
test
"GenericScrollPane test"
| pane window |
window _ (SystemWindow labelled: 'GenericScrollPane test') model: self.
pane _ GenericScrollPane new.
pane color: Color white.
pane addScrollingMorph: (EllipseMorph new extent: 50 at 90).
pane addScrollingMorph: (RectangleMorph new extent: 50 at 90).
pane addScrollingMorph: (StringMorph contents: 'Hello world').
pane addScrollingMorph: (TextMorph new).
pane addScrollingMorph: (EllipseMorph new extent: 300 at 300; color: Color blue).
window addMorph: pane frame: (0 at 0 extent: 1 at 1).
window openInWorld
! !
More information about the Squeak-dev
mailing list
|