[Magritte] exercices

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

[Magritte] exercices

Hilaire Fernandes-5
While looking at the Magritte exercices proposed by Lukas at
http://www.lukas-renggli.ch/ I founded myself locked with the exercice-18.

I found the solution might be:

MAPersonModel>>description
        ^super description copy;
                add: CustomDescription ;
                yourself

But it appears to lock the image, when updating from the web browser

Then if I execute a few 'MAPersonModel new description', I got a growing
   description (insepcting 'MAPersonModel description'), which may
explain the locked image. However I don't understand what make the
description growing.

Hilaire

Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] exercices

Lukas Renggli
> I found the solution might be:
>
> MAPersonModel>>description
>         ^super description copy;
>                 add: CustomDescription ;
>                 yourself
>
> But it appears to lock the image, when updating from the web browser
>
> Then if I execute a few 'MAPersonModel new description', I got a growing
>    description (insepcting 'MAPersonModel description'), which may
> explain the locked image. However I don't understand what make the
> description growing.

I can't investigate your problem in my own image right now, but I
think you should use #addAll: instead of #add:. Just from looking at
your code I don't exactly understand what causes the described
problem, very likely this is a bug in Magritte.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] exercices

Hilaire Fernandes-5


Lukas Renggli a écrit :

>> I found the solution might be:
>>
>> MAPersonModel>>description
>>         ^super description copy;
>>                 add: CustomDescription ;
>>                 yourself
>>
>> But it appears to lock the image, when updating from the web browser
>>
>> Then if I execute a few 'MAPersonModel new description', I got a growing
>>    description (insepcting 'MAPersonModel description'), which may
>> explain the locked image. However I don't understand what make the
>> description growing.
>
>
> I can't investigate your problem in my own image right now, but I
> think you should use #addAll: instead of #add:. Just from looking at
> your code I don't exactly understand what causes the described
> problem, very likely this is a bug in Magritte.


Not sure if it can help, but I have this MAPersonManager>>report method
where the description message is sent:

report
   report ifNil: [
        report := MAReport
           rows: self persons
           description: (MAPersonModel description select: [:each |
                #(#firstName #lastName #title #birthday) includes: each accessor
selector]).
        report addColumn: (MACommandColumn new
                addCommand: [:aPerson | self call: ((MAPersonEditor withPerson:
aPerson) component readonly: true)] text: 'vue';
                addCommand: [:aPerson | self call: (MAPersonEditor withPerson:
aPerson) component] text: 'editer';
                addCommand: [:aPerson | MAPersonManager persons remove: aPerson] text:
'supprimer').
        report rowFilter: [:model | model description anySatisfy:
                [:aDescription|
                        (aDescription toString: (model readUsing: aDescription)) matches:
self filter]]].
   ^report
       


>
> Cheers,
> Lukas
>

Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] exercices

cbeler
In reply to this post by Lukas Renggli

>> I found the solution might be:
>>
>> MAPersonModel>>description
>>         ^super description copy;
>>                 add: CustomDescription ;
>>                 yourself
>>
uhm it looks like an error I made ;) ...

MAPersonModel>>description
        ^super description copy       (<-  without  #;  otherwise it
will add over and over descriptions)
                add: CustomDescription ;
                yourself

and I used addAll: too

see you

Cédrick

Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] exercices

Hilaire Fernandes-5


Cédrick Béler a écrit :

>
>>> I found the solution might be:
>>>
>>> MAPersonModel>>description
>>>         ^super description copy;
>>>                 add: CustomDescription ;
>>>                 yourself
>>>
> uhm it looks like an error I made ;) ...
>
> MAPersonModel>>description
>        ^super description copy       (<-  without  #;  otherwise it will
> add over and over descriptions)
>                add: CustomDescription ;
>                yourself
>
> and I used addAll: too
>
> see you


Oops, yeah I see the mistake!
Nevertheless, when opening a view of a PersonModel it is duplicated many
times.

Hilaire