BuildingUIWithSpec icon indicating copy to clipboard operation
BuildingUIWithSpec copied to clipboard

Mention of self layout: aSpecLayout for DynamicComposableModel

Open philippeback opened this issue 9 years ago • 6 comments

There is no mention in the book of switching the layout of a DynamicComposableModel using #layout: aLayout

Where aLayout is one of the self class someSpec.

Took me a while to figure this out and I was busy trying

self needRebuild: false. self layout: self currentSpec.

which didn't work as they always made the system pick the defaultSpec (as the SpecInterpereter does).

philippeback avatar Jan 08 '17 14:01 philippeback

Thanks for the report! I thought this was clear from the text but apparently it is not. I will fix this ASAP.

jfabry avatar Jan 08 '17 15:01 jfabry

@philippeback Looking at the text it's not clear to my why you did not try the code that is in the "Changing the UI layout" part of the chapter (fourth page). Can you explain your thinking process?

jfabry avatar Jan 09 '17 14:01 jfabry

There is only one mention of the #layout: and it is in the tabs example with a DynamicComposableModel created on the fly. This is not my use case, I have a Model inside another one (basically, a user response model inside the larger UI. Depending on the question that I give to it, it has to adapt layout wise (show some buttons and not others, some inputs and not others, no need to add/remove widgets). Only one mention of #layout: in the text is not enough I'd say.

philippeback avatar Jan 09 '17 15:01 philippeback

Um sorry but the Dynamic Spec chapter does talk about layout in different places and the example you are talking about has a note that points to that chapter. Can you have a look there and see if it addresses your need? Maybe I need to add some text to that note.

jfabry avatar Jan 09 '17 15:01 jfabry

The best is that I write a part and issue a PR.

philippeback avatar Jan 09 '17 16:01 philippeback

Sure, go ahead! But I would still like to understand your thought process so that I can try to abstract and if needed apply it to other parts of the book as well.

jfabry avatar Jan 09 '17 18:01 jfabry