[Cuis-dev] dependency mechanism for TextModelMorph
Hilaire Fernandes
hfern at free.fr
Sun Mar 23 09:26:04 PDT 2025
What you want is the TextModelMorph (this name is extremely confusing)
to accept content on any key in:
text := 'initial value'.
textModel := TextModelMorph textProvider: self textGetter: #text
textSetter: #text: ::
acceptOnAny: true.
The model (self here) will be notified by the #text: message of any
change. You don't need to set dependency there.
In the other hand, when the model is changed with #text: here the
dependendy takes place, the Model inform any one listening there are
some changes:
text: aString
text := aString asString copy.
self changed: #text.
self changed: #clearUserEdits.
self changed: #relabel "Same as self triggerEvent: #relabel"
Regarding name, TextModelMoprh should be understood as a TextMorph,
after all it is a view. It brings confusion to the user, particularly
regarding dependency. TextModel is for internal use, and its name may
confuse you. You should not care about it.
Your Model object is the one holding your data, for example an Person
object with attribute as firstName, famillyName.
In the decoupled paradigm of MVC or MVP, TextMorph is the view, hooked
to a model. When there are changed in the TextMorph it
Take a look to your example I edited.
Hilaire
--
http://mamot.fr/@drgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250323/c76fcee0/attachment.htm>
More information about the Cuis-dev
mailing list