[Pharo-project] [squeak-dev] Use of #asMorph
siguctua at gmail.com
Sun Mar 14 14:04:22 UTC 2010
On 14 March 2010 15:38, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> I'm not convinced by your argumentation.
> #('a' 'b') collect: [:each | each asMorph]
> would mean to me that you get StringMorph or some morph representation of the object.
Yes, exactly like that.
And i want to find a convenient approach how to achieve that. Means ,
that from one side we having
a container (list, inspector, panel, window etc) and from other side,
we having a model which is a collection of items.
And i want to find a way, how an object, which you want to represent
in a container, could pick a most appropriate form
of its representation, BUT depending on a nature of container.
> If this is what you want why not but I thought you talk about container containee relationship/
I am not convinced myself that such way is feasible either. You tell :)
Usually, in most cases, a container dictating how its items should be
displayed and behave.
And usually, a model knows more than a little about items it contains
(for instance a class methods pane contains only methods, not
> On Mar 14, 2010, at 2:05 PM, Igor Stasenko wrote:
>> On 14 March 2010 14:40, stephane ducasse <stephane.ducasse at gmail.com> wrote:
>>> I do not know (I'm dizzy after a couple of hours of bus) but
>>> asMorph for me conveys the idea that we get a transformation of the receiver, while if this is just to
>>> change the model of a morph why not model:
>> Changing a model gives nothing:
>> morph := MyListMorph new.
>> morph model: someModel.
>> now, since my morph is a list, it assumes that someModel object
>> implements a protocol, which allows to extract the
>> items ( #size, #at: etc).
>> The question is, what you would do, if you want to represent each item
>> in a list as a morph, so instead of:
>> strings := model items collect: [:each | each asString ].
>> you doing:
>> subMorphs := model items collect: [:each | each asMorph ].
>> this gives you a freedom to pick any form how represent each item in a
>> list, instead of bare strings.
>> Best regards,
>> Igor Stasenko AKA sig.
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
Igor Stasenko AKA sig.
More information about the Squeak-dev