If you need it the other way around, then instead of calling it in the layout, 
there is a method on adapter named #buildWidget (or something close)
which is the perfect place for this :)

Ben

On 04 Apr 2014, at 01:53, Thomas Bany <mun.sysdev@gmail.com> wrote:

Okey so I looked deeper into the interpreter and found that the receiver of the next call is the returned value of the previous. I'm pretty sure it explains the infinite loop I was encountering.

It also made it problematic to register the morph to the anouncement of the adapter, since #addDependent: is send with a morph to the model and I needed the other way arround.

Adding #beDependentTo: somewhere in the class hierarchy of SimpleSwitchMorph make it work but I'm not sure I should do that.



2014-04-03 20:37 GMT+02:00 Thomas Bany <mun.sysdev@gmail.com>:
Hum, I was pondering the problem at home and started from scratch. I don't have the issue anymore ...


2014-04-03 18:40 GMT+02:00 Thomas Bany <mun.sysdev@gmail.com>:

Hey,

I have a quick question. I'm trying to build an adapter (called MorphicSwitchAdapter) and a model for SimpleSwitchMorp. I based my layout on the ones in existing adapter (namely MorphicButtonAdapter).

And I get stuck in an infinite loop during the interpretation of the layout of the adapter.

The first lines are:

    ^ {#SimpleSwitchMorph.
            #onColor:. #(model onColor).
            #offColor:. #(model #offColor)
                        etc...

At some point, it tries to interpret #(#model #offColor)) and a few step latter, it comes back to step one and tries to interpret #(#MorphicSwitchAdapter #adapt: #model).

I tried this alternative {#model. #onColor} (though this one is equivalent to me) and this one #model. #onColor. but to no avail.

I have a feeling that the problem stems from the fact that PluggableButtonMorph seems to allready be an adapter which take a model while SimpleSwitchMorp does not.

Could you throw some light as to why the interpretation fails ?

Again, thanks for your help !

Thomas.