It's a bit late today, so I will have a look tomorrow :)

(If I forget, feel free to insult me ^^)

Ben

On Jul 8, 2013, at 11:05 PM, Andrei Vasile Chis <chisvasileand...@gmail.com> 
wrote:

> Hi,
> 
> I've implemented a small UI using the dynamic features of spec and I'd like 
> to know if there isn't a better way to do it. My use case is simple: I have a 
> normal ComposableModel that has two models - a list and a 
> DynamicComposableModel. The DynamicComposableModel should contain a list of 
> buttons that should change every time the user selects an element in the 
> list. I've implemented a demo that can be seen if you download the package 
> DynamicSpec-Examples from 
> http://www.smalltalkhub.com/mc/AndreiChis/Playground/main and execute the 
> code from the class comment of DSChangingButtons.
> 
> My problem is that the widget containing the buttons has to define a spec 
> layout on the class side. I haven't found a way to tell the spec layout to 
> add a widget and use a method on the object for constructing the layout. I've 
> manage to get away by dynamically reconstructing the layout when the 
> selection changes, however it's not that nice because I had to duplicate the 
> layout of the main widget both on the class side and the object side. It 
> would be nice to add a widget to the layout like this: 'aSpec dynamicAdd: 
> modelGetter withSpec: aSymbol ' that would call aSymbol on the object and not 
> on the class. This may or may not make sense :)
> 
> To be concrete, the method DSToolbarModel>>updateButtons will call the method 
> dynamicLayout on it's parent which in turn will call dynamicLayoutWithSpec: 
> on the toolbar. I'd like to avoid this, and when specifying the layout of the 
> parent widget to call a method on the instance side of it subwidgets to get 
> their layout.
> 
> Now I'll end here this rather long email :)
> 
> Cheers,
> Andrei

Reply via email to