[Cuis-dev] my first submitted change set
Mark Volkmann
r.mark.volkmann at gmail.com
Thu Sep 12 19:15:14 PDT 2024
On Wed, Sep 4, 2024 at 10:27 AM Juan Vuletich <juan at cuis.st> wrote:
> On 9/1/2024 6:03 PM, Mark Volkmann via Cuis-dev wrote:
>
> In the Todo app I created in order to learn more about Morphic, I needed
> to execute some code when the extent of PluggableScrollPane is changed.
> The code changes the size of the "scroller" morph associated with the
> PluggableScrollPane. Here's a snippet this shows how I use it:
>
> scrollPane onExtentChanged: [ :newExtent |
> todosPane morphWidth: (scrollPane hScrollBarWidth - 10).
> ].
>
> To achieve this, I created a subclass of PluggableScrollPane that adds
> the onExtentChanged: method.
>
> The attached ChangeSet adds this capability to PluggableScrollPane so
> it's unnecessary to create a subclass. It does three things:
>
> - adds the instance variable onExtentChanged
> - adds the instance method extendChanged: to set that instance variable
> to a block
> - adds the following line to the end of the existing extentChanged: method
>
> onExtentChanged ifNotNil: [ onExtentChanged value: self morphExtent ].
>
>
> Interesting experiment. I'd say the same effect should be possible by
> implementing #adjustExtent in the todosPane object, and that it would be
> better style.
>
Sorry it took me so long to get back with you on this. I was out on
vacation.
Previously todosPane was a LayoutMorph. I created the class TodosPane as a
subclass of LayoutMorph and made todosPane be an instance of that. This
works, but perhaps is not what you had in mind.
TodosPane has the following class method:
new
^ self newColumn
TodosPane has the following instance methods:
initialize
super initialize.
self useEdgeSpace: false.
self adjustExtent.
self color: Color transparent.
adjustExtent
owner ifNotNil: [ self morphWidth: owner viewableWidth ]
--
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240912/bc73874e/attachment.htm>
More information about the Cuis-dev
mailing list