<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Hilaire,</p>
    <p>I don't know what was the expected behavior when that code was
      written. I think it comes from Squeak and is like 24 years old.</p>
    <p>I think the behavior you expect makes sense: When someone
      triggers an event, it includes the 'default' arguments, but
      whoever subscribed to it specifying which selector to use, if they
      also specify arguments, then those arguments should be used
      instead.</p>
    <p>The attach is my code for this. It doesn't seem to affect the
      base image at all, but I can't say about external packages.</p>
    <p>Everybody, please take a look and try it. If nobody sees a
      problem, I'll push it.</p>
    <p>Thanks,</p>
    <div class="moz-cite-prefix">On 19/07/2025 8:24 AM, Hilaire
      Fernandes via Cuis-dev wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:08bc51b3-3d48-4910-b0fb-53ee2ddc1fa4@free.fr">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p><font size="4">Hi, <br>
        </font></p>
      <p><font size="4">I have this situation where an <b>objectA</b>
          can emit event with a default argument (</font><b><font
            color="#a51d2d">self</font></b><font size="4">):</font></p>
      <blockquote>
        <pre><font size="4">FilePreviewMorph>>doubleClick: event localPosition: position</font>
<font size="4">    self triggerEvent: #doubleClick with: <b><font
        color="#a51d2d">self
</font></b></font></pre>
      </blockquote>
      <p><font size="4">And the listening <b>objectB</b> wants to be
          notified with a different argument (</font><font
          color="#a51d2d"><b>fileEntry</b></font><font size="4">)</font></p>
      <blockquote>
        <pre><font size="4">fileView when: #doubleClick send: #open: to: self with: <b><font
        color="#a51d2d">fileEntry</font></b>].
</font></pre>
      </blockquote>
      <p><font size="4">However when the event is triggered in <b>objectA</b>
          the optional prefered argument by <b>objectB</b> (fileEntry)
          is not used. It is still the <b>self</b> argument.</font></p>
      <p><font size="4">Is it the expected behavior?<br>
        </font></p>
      <p><font size="4">The behavior is revealed here:</font></p>
      <p><font size="4"><img src="cid:part1.QGL1FVwF.5OUAo1X9@cuis.st"
            alt="" class=""></font></p>
      <p><font size="4"><br>
        </font></p>
      <p><font size="4"><font face="monospace">arguments</font> contains
          the fileEntry but it is ignored as show the value of <font
            face="monospace">argsToUse</font>.</font></p>
      <p><font size="4">Change in method bellow adjust this behavior.
          Not sure it is what is expected.<br>
        </font></p>
      <pre><font size="4">collectArguments: anArgArray
    "Private"
    | staticArgs |
    staticArgs := self arguments.
    ^(anArgArray size = staticArgs size)
        ifTrue: [</font><font size="4"><b>staticArgs asNewArra</b></font><font
      size="4">]
        ifFalse:
            [(staticArgs isEmpty
                ifTrue: [ staticArgs := Array new: selector numArgs]
                ifFalse: [staticArgs asNewArray] )
                    replaceFrom: 1
                    to: (anArgArray size min: staticArgs size)
                    with: anArgArray
                    startingAt: 1]
</font></pre>
      <pre><font size="4">
</font></pre>
      <p><font size="4">Thanks</font></p>
      <p><font size="4">Hilaire<br>
        </font></p>
      <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://mamot.fr/@drgeo"
      moz-do-not-send="true">http://mamot.fr/@drgeo</a></pre>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis.st">www.cuis.st</a>
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich</pre>
  </body>
</html>