Event system problem?

John W. Sarkela sarkela at sbcglobal.net
Mon Jul 7 09:37:20 UTC 2003


The selector #removeDependent: is the message to undo the work of the 
selector #addDependent:. These selectors are confined to the realm of 
traditional changed/update processing. EventManager reimplements 
changed/update in terms of the event #changed:.

To release a dependent from an arbitrary event source, try the 
following.

"remove all actions that tie dependentObject to eventSource"
eventSource removeActionsWithReceiver: dependentObject

Note that there are a variety of deregistration messages, all of which 
match #removeActions*. The core release mechanisms for event dependency 
may be found in message category Object>events-removing. There should 
be tests for #removeActionsWithReceiver: and #removeActionsForEvent:.

:-}> John Sarkela

On Sunday, June 29, 2003, at 06:30 AM, Roel Wuyts wrote:

> Hello,
> I am playing with the Squeak events system (NOT the one for Morphs!), 
> and I have the impression that something is wrong with unregestering 
> events...
>
> Unregestering for actions work, as shown by the unit tests for the 
> events. But unregestering for individual objects seems to be broken, 
> unless these objects registered for the #changed: event.
>
> For example, the following piece of code does not work as expected:
>
> | eventSource dependentObject |
> eventSource := EventManager new.
> dependentObject := Object new.
>
> "register - dependentObject becomes dependent"
> eventSource
> 	when: #anEvent send: #error to: dependentObject.
>
> "unregister dependentObject"
> eventSource removeDependent: dependentObject.
>
> [eventSource triggerEvent: #anEvent]
> 	on: Error
> 	do: [:exc | self halt: 'Should not be!'].
>
>
>
> --
> Roel Wuyts                                                   Software 
> Composition Group
> roel.wuyts at iam.unibe.ch                       University of Bern, 
> Switzerland
> http://www.iam.unibe.ch/~wuyts/
> Board Member of the European Smalltalk User Group: www.esug.org
>



More information about the Squeak-dev mailing list