[Pharo-project] An idea about Pluggable widgets

Igor Stasenko siguctua at gmail.com
Thu Apr 7 16:14:57 CEST 2011


On 7 April 2011 16:04, Esteban Lorenzano <estebanlm at gmail.com> wrote:
> I'm using a similar approach for Mars.
> Views in Mars always consume from a similar structure and we have the concept of "model adaptor" when you need to adapt from your model to the views. We also have a couple of generic adaptors who adapts nicely to your model.
> Let's say we need to place a string into a MRLabel, and model for label is prepared to understand #content message.
> so you say something like this:
>
>        MRLabel new
>                model: ('My label' adaptAccessor: #yourself);
>                ...etc...
>
> and that way you have "cleanness" in both sides :)
>
> other problems is when widgets triggers events (like your example, a button click, named performAction).
> I think here you should not trigger anything but an announcement.
> Your performAction should look more like:
>
> performAction
>        self announce: ButtonPressed
>
> and your "client code" should look:
>
> MRButton new
>        on: ButtonPressed do: [ ... whatever... ]
>
>
> So, summarizing.... I "more or less" agree with your approach. Or better I mean: I agree in the "accessing" part, but I would like using announcements to trigger events.

Yes, but that is another step , another milestone. If you do it
gradually, first you clean the mess out, and then introduce
announcements,
otherwise you have good chances to not deliver, because for
announcements you need to use different api and rewrite things
everywhere.

While model adaptors (i like the naming btw) could be introduced
seamlessly without breaking existing code that much.

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Pharo-project mailing list