Your comment on #valueChanged is noted.
As for the code, I have rewritten it and cleaned it up a bit, and got it to work. But I am not sure I am on the right track as I am unable to find any clear documentation. I have included the relevant parts here below for your kind advice. It is a simple project I am undertaking to learn Dolphin Smalltalk. Also, I am following, in parallel, Ted Bracht’s ‘The Dolphin Smalltalk Companion’ book I got ages ago, but not all is evident as this was written for DS 3.0.
- First, the Model's method that triggers a #valueChanged message, indicating that the 'section properties' need to be updated in the View. This is called when the rectangle width or height changes:
reSetProperties
"Private - re-calculates all section properties - AND triggers a change message"
self setProperties.
self trigger: #sectionPropertiesChanged.
- Second, the Presenter's model, where, in the second part, Presenters register interest (if that's correct) in the change message described above.
(The book, chapter 4, does not mention this at all; hence my confusion):
model: aFB_Rectangle
"Create the link between presenter INSTANCE VARIABLES and the model INSTANCE VARIABLES"
super model: aFB_Rectangle.
namePresenter model: (aFB_Rectangle aspectValue: #name).
widthPresenter model: (aFB_Rectangle aspectValue: #width).
heightPresenter model: (aFB_Rectangle aspectValue: #height).
perimeterPresenter model: (aFB_Rectangle aspectValue: #perimeter).
areaPresenter model: (aFB_Rectangle aspectValue: #area).
xcPresenter model: (aFB_Rectangle aspectValue: #xc).
ycPresenter model: (aFB_Rectangle aspectValue: #yc).
ixPresenter model: (aFB_Rectangle aspectValue: #ix).
iyPresenter model: (aFB_Rectangle aspectValue: #iy).
perimeterPresenter model aspectTriggers: #sectionPropertiesChanged.
areaPresenter model aspectTriggers: #sectionPropertiesChanged.
xcPresenter model aspectTriggers: #sectionPropertiesChanged.
ycPresenter model aspectTriggers: #sectionPropertiesChanged.
ixPresenter model aspectTriggers: #sectionPropertiesChanged.
iyPresenter model aspectTriggers: #sectionPropertiesChanged.
With those changes, I got the View to update correctly. But maybe there is a better or simpler way?
Thanks & regards,
FB