2015-02-01 0:54 GMT+01:00 Peter Uhnák <[email protected]>:
> Changing Tab name after the UI has been build fails, since it tries to set
> the label to MorphicTabAdapter instead of Tab.
>
> I could fix it by changing in TabModel>>initialize
>
> label whenChangedDo: [ :new | self widget ifNotNil: [ :w | w label: new ]
> ].
> to
> label whenChangedDo: [ :new | self widget ifNotNil: [ :w | w widget label:
> new ] ].
>
> but setting it this way feels weird (not mentioning Demeter).
> Maybe the MorphicTabAdapter should delegate it?
>
> Apart from label this also applies to icon and most likely to all other
> stuff (morph, retrievingBlock, ...)
>
> Peter
>
Looking at the other spec models and morphic adapter shows:
(ButtonModel for example)
The model registers a whenChangedDo: block (for example for the label)
the whenChangedDo: block for the attribute #label calls> self changed:#label
(and changing the label on the morph actually happens in the
PluggableButtonMorph #update: method)
This does not work yet for a Tab morph because
1. in Tab>>#model: it does not registers itself as an dependent of the
model
(therefore the call self changed:#label would not reach the Tab Morph)
2. The Tab Morph does not implement #update:, so, even if we change the
#model: method
the Tab Morph does not know how to deal with the different update
arguments
I would vote for: Fix the Tab Morph, so it behaves like other morphs
(register the dependents in #model: and react in #update:
on all changeable attributes (label, state, icons..))
nicolai