[Cuis-dev] Adding Scrollbar to an arbitrary Morph
Hilaire Fernandes
hilaire at drgeo.eu
Thu Oct 21 07:15:37 PDT 2021
Hi Juan,
As we can add scrollbar to arbitrary morph without subclassing (this is
very cool for end user scripting), we may need the accessors
#scrollDeltaHeight: and #scrollDeltaWidth: to adjust the v/h delta for
the scroll events. Here is a proposed changed set.
I saw the classes HierarchicalListMorph, PluggableListMorph,
TextModelMorph override the getters, it may be wise to remove these
getters and adjust the variable accordingly in the respective initialize
methods. I did not do that because I will likely break the image.
Best
Hilaire
Le 19/10/2021 à 14:57, Juan Vuletich a écrit :
> I thought this was working. Just pushed some updates to make it work
> again. See examples in class comment in PluggableScrollPane. Play with
> the halo with the inner morph, see how scrollbars adjust themselves as
> needed.
>
> Thanks,
--
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211021/567397ee/attachment.htm>
-------------- next part --------------
'From Cuis 5.0 [latest update: #4935] on 21 October 2021 at 4:04:30 pm'!
!classDefinition: #PluggableScrollPane category: 'Morphic-Widgets'!
PluggableMorph subclass: #PluggableScrollPane
instanceVariableNames: 'scrollBar scroller hScrollBar hideScrollBars drawKeyboardFocusIndicator scrollerScale scrollerRadians theScrollerExtent scrollDeltaHeight scrollDeltaWidth '
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Widgets'!
!PluggableScrollPane methodsFor: 'geometry' stamp: 'hlsf 10/21/2021 15:58:02'!
scrollDeltaHeight: anInteger
scrollDeltaHeight _ anInteger.
self vSetScrollDelta ! !
!PluggableScrollPane methodsFor: 'geometry' stamp: 'hlsf 10/21/2021 15:57:32'!
scrollDeltaWidth: anInteger
scrollDeltaWidth _ anInteger .
self hSetScrollDelta ! !
!PluggableScrollPane methodsFor: 'geometry' stamp: 'hlsf 10/21/2021 15:50:36'!
scrollDeltaHeight
"Return the increment in pixels which this pane should be scrolled."
^ scrollDeltaHeight! !
!PluggableScrollPane methodsFor: 'geometry' stamp: 'hlsf 10/21/2021 15:51:11'!
scrollDeltaWidth
"Return the increment in pixels which this pane should be scrolled."
^scrollDeltaWidth
! !
!PluggableScrollPane methodsFor: 'initialization' stamp: 'hlsf 10/21/2021 15:52:19'!
initialize
"initialize the state of the receiver"
super initialize.
hideScrollBars _ #showIfNeeded.
"initialize the receiver's scrollBars"
scrollBar _ ScrollBar new model: self setValueSelector: #vScrollBarValue:.
scrollDeltaHeight _ 10.
hScrollBar _ ScrollBar new model: self setValueSelector: #hScrollBarValue:.
scrollDeltaWidth _ 10.
drawKeyboardFocusIndicator _ Preferences drawKeyboardFocusIndicator.
self addMorph: scrollBar.
self addMorph: hScrollBar.
self updateScrollBarsBounds.
self innerMorphClass ifNotNil: [ :contentsClass |
self scroller: contentsClass new ].! !
!classDefinition: #PluggableScrollPane category: 'Morphic-Widgets'!
PluggableMorph subclass: #PluggableScrollPane
instanceVariableNames: 'scrollBar scroller hScrollBar hideScrollBars drawKeyboardFocusIndicator scrollerScale scrollerRadians theScrollerExtent scrollDeltaHeight scrollDeltaWidth'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Widgets'!
More information about the Cuis-dev
mailing list