<div dir="ltr">Marcel, Thanks!<div><br></div><div>Your example is very helpful. I think I can build on this :-)</div><div><br></div><div>It makes me think that  it would be reasonable to implement a variety of sub-classes of #textMorph for different data objects within my Business Model. By this I mean that I would have a DateTextMorp which would only allow valid dates or IntegerTextMorph which would only accept integer values or ProductNumberTextMorph which would only accept valid numbers from a dictionary of product numbers?</div><div><br></div><div>Cheers,</div><div><br></div><div>jrm</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 12, 2018 at 6:05 AM, Marcel Taeumel <span dir="ltr"><<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id="m_4288510756047845664__MailbirdStyleContent" style="font-size:12pt;font-family:calibri;color:#000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi, there.<div><br></div><div>Sorry for my apparently confusing explanation. :-)</div><div><br></div><div>Please find a attached a change set to file-in via drag-drop into your image. It contains the class MyTextMorph. Then you can try out the following code in your workspace:</div><div><br></div><div><div>| container fieldOne fieldTwo |</div><div><br></div><div>container := Morph new.</div><div>fieldOne := MyTextMorph new.</div><div>fieldTwo := MyTextMorph new.</div><div><br></div><div>container</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">     </span>color: Color white;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">        </span>extent: 400@100;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">   </span>layoutPolicy: TableLayout new;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">     </span>layoutInset: 2;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">    </span>listDirection: #leftToRight.</div><div><br></div><div>fieldOne</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">       </span>hResizing: #spaceFill;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">     </span>vResizing: #spaceFill.</div><div><br></div><div>fieldTwo</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">     </span>hResizing: #spaceFill;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">     </span>vResizing: #spaceFill.</div><div><br></div><div>fieldOne contents: 'Hello World!'.</div><div>fieldTwo contents: '?????'.</div><div><br></div><div>container</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">        </span>addMorphBack: fieldOne;</div><div><span class="m_4288510756047845664Apple-tab-span" style="white-space:pre-wrap">    </span>addMorphBack: fieldTwo.</div><div><br></div><div>fieldOne addDependent: fieldTwo.</div><div><br></div><div>container openInWorld.</div></div><div><br></div><div>-----</div><div><br></div><div>Note that TextMorph has actually NO support for #on:send:to: at the moment bc. it overrides various methods that ignore EventHandler. You have to implement #handlesMouseOver:, #mouseLeave, and #update:with:. See the attached changeset.</div><div><br></div><div>Best,</div><div>Marcel</div><div><div class="h5"><div class="m_4288510756047845664mb_sig"></div>
                                        
                                        <blockquote class="m_4288510756047845664history_container" type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
                        <p style="color:#aaaaaa;margin-top:10px">Am 12.01.2018 02:57:57 schrieb John-Reed Maffeo <<a href="mailto:jrmaffeo@gmail.com" target="_blank">jrmaffeo@gmail.com</a>>:</p>______________________________<wbr>_________________
Beginners mailing list
<a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.<wbr>squeakfoundation.org</a>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a>
<div dir="ltr">Marcel,<br><br>Thanks for your reply.<br><br>I don't know why it is so difficult for me to grock (does anyone say that anymore?) this stuff, however your answer does not clarify my understanding:-( I will attempt to use #on:send:to::in my solution, however, I would appreciate a Workspace example of #on:send:to:withValue to satisfy my curiosity. I will write something in the wiki for future reference once I understand it :-)<br><br>Cheers,<br>jrm<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 11, 2018 at 6:33 AM, Marcel Taeumel <span dir="ltr"><<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;min-width:500px"><div id="m_4288510756047845664m_-3192287525604753972__MailbirdStyleContent" style="font-size:12pt;font-family:calibri;color:#000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi, there. :)<div><br></div><div>Well, #on:send:to: works best if the target's source code is under your control. In your example, you would implement something like #setContentsEvent:from: in MyTextMorph. There, you have access to the mouse event and to the source morph to access the contents.</div><div><br></div><div>I would like to explain two other things, too:</div><div>1) You only need to call #addDependent: in the source if you want to implement or use #update: in the target. That's not the case in your example. You do not need it here.</div><div>2) The way #on:send:to:withValue: works is, in my opinion, broken. It only supports you to configure a single, hard-coded value, to be passed as first argument in a three-arg-selector. This is useless if you think about having multiple callbacks configured via #on:send:to:withValue:. We should fix that in the future.</div><div><br></div><div>Best,</div><div>Marcel</div><div class="m_4288510756047845664m_-3192287525604753972mb_sig"></div>
                                        
                                        <blockquote class="m_4288510756047845664m_-3192287525604753972history_container" type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;min-width:500px">
                        <p style="color:#aaaaaa;margin-top:10px">Am 11.01.2018 03:33:27 schrieb John-Reed Maffeo <<a href="mailto:jrmaffeo@gmail.com" target="_blank">jrmaffeo@gmail.com</a>>:</p>______________________________<wbr>_________________
Beginners mailing list
<a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundati<wbr>on.org</a>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><div><div class="m_4288510756047845664h5">
<div dir="ltr"><div>#EventHandler halts with this warning from the method #on:send:to:withValue:</div><div><br></div>How does this work? I can't find an example.<div><br></div><div>I am trying to learn how to use TextMorph in an application. My simple test case is a morph containing two TextMorphs. I want the second morph to contain the contents of the first morph when that morph loses focus.</div><div><br></div><div>start -------------------</div><div><div>|borMor tMor1 tMor2 |</div><div><br></div><div>borMor := BorderedMorph new.</div><div>borMor color: Color white.</div><div>borMor width: 44.</div><div>tMor1 := TextMorph new.</div><div>tMor1 contents: 'Hello World!'.</div><div>tMor2 := TextMorph new.</div><div>tMor2 contents: '?????'.</div><div>tMor1 addDependent: tMor2.</div><div><br></div><div>borMor  layoutPolicy: TableLayout new;</div><div><span style="white-space:pre-wrap">   </span> listDirection: #leftToRight;</div><div><span style="white-space:pre-wrap">    </span> wrapCentering: #topLeft;</div><div><span style="white-space:pre-wrap">        </span> hResizing: #spaceFill;</div><div><span style="white-space:pre-wrap">  </span> vResizing: #spaceFill;</div><div><span style="white-space:pre-wrap">  </span> layoutInset: 2;</div><div><span style="white-space:pre-wrap"> </span> rubberBandCells: true.</div><div><br></div><div>borMor addMorph: tMor1. </div><div>tMor1 addDependent: tMor2.</div><div>borMor addMorph: tMor2.<span style="white-space:pre-wrap"> </span></div><div>tMor1 on: #mouseLeave send: #contents: to: tMore2 withValue: #(tMor1 contents nil).<span style="white-space:pre-wrap">      </span></div><div><br></div><div><br></div><div>borMor openInWorld.</div><div><br></div><div>end -----------------</div><div><br></div><div>This may not be the best way to approach the problem, but I would like to know how to use the method in any case.</div><div><br></div><div>Thanks,</div><div><br></div><div>jrm</div><div><br></div><div><br></div></div></div>

                        </div></div></blockquote></div><br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundati<wbr>on.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div></div>

                        </blockquote></div></div></div><br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>