[Cuis-dev] Pluggable List of Morph

Nicolás Papagna Maldonado nicolas.papagna at gmail.com
Fri Jan 14 08:12:35 PST 2022

Hi Hilarie!

I subclassed PluggableMorph and build my way from there.
Implemented #layoutSubmorphs to calculate which ones should be displayed
based on the scroll position and the item heights (similar to what
LayourMoph does when it is created as a column).

I took a different approach wrt items though: unlike PluggableListMorph and
friends where the list is in control of everything (which item is selected,
highlighted, item click handler, etc), I wanted to see what happened when
the "control is inverted" and all these responsibilities are moved to the
item themselves.

That leaves the list with the responsibility of keeping the scroll
positions, efficiently laying out submorphs, and a couple more things.

It worked great for my use case. Not all items should be instances of the
same morph (items can have varying heights) and this gets you lots of
flexibility to play with.

I will send the code over the weekend (just got back from a trip).

Nico PM

On Thu, Jan 13, 2022 at 5:11 PM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi Nicola et al.
> After some thinking,  a InnerListOfMorph should simply be a subclass of
> MorphLayout (beColumn).
> The InnerListMorph draws directly its text content, highlight, selected.
> It could have been designed with a row of TextMorph but would have been
> inefficient.
> Nicolas, which direction did you took for your initial design?
> Hilaire
> Le 11/01/2022 à 21:14, Hilaire Fernandes a écrit :
> Hi Nicola,
> Nice, I started subclassing those close for Morph, but not sure now it is
> the right way. Need to check again. In fact all could be simplified with
> only Morph as text in list can be morph too.
> Need some time to think about it..
> Best
> Hilaire
> Le 08/01/2022 à 16:07, Nicolás Papagna Maldonado a écrit :
> Hi Hilarie!
> I had similar needs for a couple of projects (a generic, scrollable list
> of morphs -- PluggableListMorph but having any morph as an item).
> Initially, I took a look at PluggableListMophr, InnerListMorph, and
> friends but found them a bit hard to understand/change for what I needed
> (based on my very little experience with Morphic at the time).
> After some time I decided to "roll my own" because it looked like these
> classes were not created for that purpose, and also I really wanted to get
> into/learn how UI components work.
> I never finished the component but got it working fine for the PoC I was
> building at the time.
> The mail about Cuis-Smalltalk-UI got me thinking of getting it back in
> shape.
> Best,
> Nico PM
> --
> GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
> --
> GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev


Nicolás Papagna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220114/b68ad5a4/attachment.htm>

More information about the Cuis-dev mailing list