[squeak-dev] PluggableMultiColumnListMorph>getListItem:

tim Rowledge tim at rowledge.org
Wed Mar 1 22:15:02 UTC 2017


> On 01-03-2017, at 11:54 AM, Milan Vavra <vavra_milan at yahoo.com> wrote:
> 
> Hi Tim,
> 
> "Instead of"
> 
> rows := #(
> 	( 1 2 )
> 	( Brooks Robert )
> 	( Brooks Victoria )
> 	( Burton Geraldine )
> 	( Chason Rhoda )
> 	( Chason Robert )
> 	( Chung Bernard )
> 	( Holder Crystal )
> ).
> 
> "PluggableMultiColumnListMorph needs"
> 
> columns := #(
> 	( 1 Brooks Brooks Burton Chason Chason Chung Holder )
> 	( 2 Robert Victoria Geraldine Rhoda Robert Bernard Crystal )
> ).

Oh, I know that part ok; the SoundLibraryTool list is a pair of collections wrapped in a collection, so we’re not getting it wrong there.

The problem starts in #yellowButtonActivity: where #buildYellowButtonMenu: starts going after nested menu items and that leads to Morph>allStringsAfter: which as Yoda would say “leads to paaaaaiiiiin”
If you try it out you’ll see how it goes; and the problem is what should a multi-column list return for #getListItem: ? Once you start looking at that you notice that the result is being used in a way that assumes string-ness in some places and not in others. See, for example PluggableListMorph>getListItem: and follow back through what might be in the ‘list’ ivar, or the result from #getList, and indeed from the model perform: … stuff which is forced to string-ness.

The simplest answer I can think of - and it’s a long way from a proper, well thought out solution - is to over-ride #getListItem: and return the relevant item from just the first list. This avoids concerns about what composite items might exist and how to present it. 

And all this simply gets thrown away! The menu code is just building that entire complex of morph userStrings to see if it is empty! And it only even happens if your image has the ridiculous ‘generalizedYellowButtonMenu’ preference enabled, which surely must be one of the least  options I’ve ever seen.

I suspect that some thought about the proper use of the userStrings concept might be useful here. Is it really sensible for a morph representing a list of items to provide a potentially huge string concatenating the content of each list item?

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: MII: Mask all Interrupts and then Interrupt




More information about the Squeak-dev mailing list