[Cuis-dev] triggering event with argument, emitter or listener last word?

Hilaire Fernandes hfern at free.fr
Sat Jul 19 04:24:09 PDT 2025


Hi,

I have this situation where an *objectA* can emit event with a default 
argument (*self*):

    FilePreviewMorph>>doubleClick: event localPosition: position
         self triggerEvent: #doubleClick with: *self *

And the listening *objectB* wants to be notified with a different 
argument (*fileEntry*)

    fileView when: #doubleClick send: #open: to: self with: *fileEntry*].

However when the event is triggered in *objectA* the optional prefered 
argument by *objectB* (fileEntry) is not used. It is still the *self* 
argument.

Is it the expected behavior?

The behavior is revealed here:


arguments contains the fileEntry but it is ignored as show the value of 
argsToUse.

Change in method bellow adjust this behavior. Not sure it is what is 
expected.

collectArguments: anArgArray     "Private"     | staticArgs |     
staticArgs := self arguments.     ^(anArgArray size = staticArgs size) 
         ifTrue: [*staticArgs asNewArra*]         ifFalse:             
[(staticArgs isEmpty                 ifTrue: [ staticArgs := Array new: 
selector numArgs]                 ifFalse: [staticArgs asNewArray] ) 
                     replaceFrom: 1                     to: (anArgArray 
size min: staticArgs size)                     with: anArgArray 
                     startingAt: 1]

Thanks

Hilaire

-- 
http://mamot.fr/@drgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250719/46b70101/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QcSmOQvTsvdvH4tp.png
Type: image/png
Size: 87632 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250719/46b70101/attachment-0001.png>


More information about the Cuis-dev mailing list