Hi !

First, I apologyse for the wall of text.

I'm trying my hands at Spec and I have few questions:
  • How can I implement an instance-dependent layout ?
Regarding the layout method lookup, the documentation states that it "starts on instance side, which allows a UI to have a more specific layout depending on the state of the instance"

I tried to simply put a layout in an instance method with the <spec: #default> pragma. But not only was it not retrieved by ComposableModel>#defaultSpecSelector but ComposableModel>#retrieveSpec: will send the selector on the class anyway.

What I ended up doing was overiding #openWithSpec (which worked) but I'm pretty sure that my model is not composable at all.
  • Is it possible to change the "skin" of the basic widget ?

I would like to implement some sort of toggle button by changing the color of ButtonModel and so far, I failed. I was not able to trace my color change up to the PluggableButtonMorph because it seems to use anoucement and I'm a Smalltalk rookie.

I tried however to send #color: directly to the morph which does nothing: the #changed method rolls it back to its previous value. So I may be doing something wrong but it doesn't feel like the issue comes from Spec. Any clue ?

  • On a side note, I tried to send an argument to the selector that retrieve a widget in the layout method.
And I came up with this :

layout add: {#buttonAt: . 1}; add: {#buttonAt: . 2}; add: {#buttonAt: . 3}

Is it how it's done ?


Thanks in advance !

Thomas.