<div dir="ltr">Thanks so much for this tip! Clearly a key to getting this to work is knowing the symbols that the watched object passes to the <font face="monospace">changed:</font> method. I see that the <font face="monospace">TextModel</font> instance method <font face="monospace">actualContents:</font> uses the symbol <font face="monospace">#actualContents</font>. So I tried the following to test whether I could make a sound every time the text in a <font face="monospace">TextModelMorph</font> is modified:<div><br></div><div><font face="monospace">Preferences at: #soundsEnabled put: true.<br>model := TextModel withText: 'Hello'.<br>model when: #actualContents send: #primitiveBeep to: Smalltalk.<br>input := TextModelMorph withModel: model.<br>input openInWorld.</font><br></div><div><br></div><div>I don't hear sounds when modifying the value. I thought perhaps the problem is that the <font face="monospace">TextModel</font> instance method <font face="monospace">actualContents:</font> is not called every time the value is modified. But even when I explicitly invoke it with <font face="monospace">model actualContents: 'Test'</font>, I don't hear a sound. I do hear a sound when I evaluate <font face="monospace">Smalltalk primitiveBeep</font>.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sun, Jan 12, 2025 at 10:23 PM Weslleymberg Lisboa via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi, Mark<br>
<br>
I think Object>>when:send:to: is what you are looking for. Call it on <br>
your TextModel instance to register and object to be notified. I'm still <br>
learning this mechanism, but this wiki page might be of some help:<br>
<br>
<a href="https://github.com/nmingotti/The-Cuis-CookBook/wiki/The-Dependency-Mechanism--3" rel="noreferrer" target="_blank">https://github.com/nmingotti/The-Cuis-CookBook/wiki/The-Dependency-Mechanism--3</a><br>
<br>
Em 12/01/2025 23:04, Mark Volkmann via Cuis-dev escreveu:<br>
> Is there a way to register to have a message sent to a given object <br>
> every time the "model actualContents" value of a TextModelMorph changes? <br>
> I searched through the code for TextModelMorph and TextModel, but <br>
> couldn't find a solution.<br>
> <br>
> -- <br>
> R. Mark Volkmann<br>
> Object Computing, Inc.<br>
> <br>
<br>
-- <br>
Wéslleymberg Lisboa<br>
Graduado em Sistemas de Informação<br>
Docente no IFFluminense - Campus Itaboraí<br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div>