PluggableMultiColumnListMorph broken?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PluggableMultiColumnListMorph broken?

Jeff Gray
Is PluggableMultiColumnListMorph broken in 1.4?

If I have a very simple case within a polymorph window:

PluggableMultiColumnListMorph on: self list: #actorMultiList selected: nil changeSelected: nil menu: nil keystroke: nil wrapSelector: nil

and the actorMultiList method is:
^ #(('a' 'b' 'c' 'd') ('1' '2' '3' '4') ('alpha' '20' 'beta' 'gamma'))

then I get the following error: Character(Object) doesNotUnderstand: #widthToDisplayInList:

Reply | Threaded
Open this post in threaded view
|

Re: PluggableMultiColumnListMorph broken?

Benjamin Van Ryseghem (Pharo)
We have introduced a dispatch in the list, allowing every kinds of object to be displayed if the provide the good interface.
Right now, this interface is provided by String, Text, and Morph.

On the other hand, the PluggableMultiColumnListMorph is designed to take "real" object as entry, and then the wrapping method is used to specify how to split the object into multiple columns.
And by default, the wrappingMethod returns the printString of the object.
So in your case, the elements (which are collections) are turned into a String like '#('a' 'b' c')', and when the list iterates over the object, it iterates on characters.

Maybe the default behavior should be changed, because if you do not precise, it will hangs.

To fix your example, you can do

PluggableMultiColumnListMorph on: self list: #actorMultiList selected: nil
changeSelected: nil menu: nil keystroke: nil wrapSelector: #wrap:

wrap: item

        ^ item

Note that the result will be

a           b     c         d
1           2     3         4
alpha 20 beta gamma

The list provides rows, not columns anymore

Ben

On Jul 3, 2012, at 5:50 AM, Jeff Gray wrote:

> Is PluggableMultiColumnListMorph broken in 1.4?
>
> If I have a very simple case within a polymorph window:
>
> PluggableMultiColumnListMorph on: self list: #actorMultiList selected: nil
> changeSelected: nil menu: nil keystroke: nil wrapSelector: nil
>
> and the actorMultiList method is:
> ^ #(('a' 'b' 'c' 'd') ('1' '2' '3' '4') ('alpha' '20' 'beta' 'gamma'))
>
> then I get the following error: Character(Object) doesNotUnderstand:
> #widthToDisplayInList:
>
>
>
> --
> View this message in context: http://forum.world.st/PluggableMultiColumnListMorph-broken-tp4637828.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>