Hi,
I'm currently playing around with the events mechanism and was wondering if 'when:' has an 'inverse' method. If when: (and friends) lets me subscribe to some event notification, is there a method to unsubscribe me? Thanks |
Fernando,
> I'm currently playing around with the events mechanism and was > wondering if 'when:' has an 'inverse' method. > > If when: (and friends) lets me subscribe to some event notification, is > there a method to unsubscribe me? Browse Object, filter to the events category, and look at the #remove* methods. You can remove all events, or (probably more useful) all events triggered for a specified receiver. Dolphin event mechanism uses weak references, so you seldom need to unhook. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Fernando Rodríguez
Fernando,
> I'm currently playing around with the events mechanism and was > wondering if 'when:' has an 'inverse' method. > > If when: (and friends) lets me subscribe to some event notification, is > there a method to unsubscribe me? A pointer first. If you are trying to find a particular method you can often narrow down the search by using categories. In this case you know about the method #when:send:to: so checking for implementors of that message shows that it's only implemented in Object. Selecting Object>>when:send:to: in a browser shows it's category as #events. Selecting the #events category in the category list tells the browser to only display methods belonging to that category and includes the following - #removeAllEventsTriggered #removeEventsTriggeredFor: and checking the method comments tells you what their purpose is. #removeAllEventsTriggered will remove all the events that the receiver triggers. You are more likely to want the second, #removeEventsTriggeredFor: which removes all the events registered for a particular target ... aClass when: #whatever send: #something to: whoever ... aClass removeEventsTriggeredFor: whoever What you _can't_ do in the base image, and I've had to add it myself when needed, is to remove specific events aClass removeEvent: #whatever triggeredFor: whoever -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
In reply to this post by Fernando Rodríguez
Fernando,
> I'm currently playing around with the events mechanism and was > wondering if 'when:' has an 'inverse' method. > > If when: (and friends) lets me subscribe to some event notification, is > there a method to unsubscribe me? A pointer first. If you are trying to find a particular method you can often narrow down the search by using categories. In this case you know about the method #when:send:to: so checking for implementors of that message shows that it's only implemented in Object. Selecting Object>>when:send:to: in a browser shows it's category as #events. Selecting the #events category in the category list tells the browser to only display methods belonging to that category and includes the following - #removeAllEventsTriggered #removeEventsTriggeredFor: and checking the method comments tells you what their purpose is. #removeAllEventsTriggered will remove all the events that the receiver triggers. You are more likely to want the second, #removeEventsTriggeredFor: which removes all the events registered for a particular target .. aClass when: #whatever send: #something to: whoever .. aClass removeEventsTriggeredFor: whoever What you _can't_ do in the base image, and I've had to add it myself when needed, is to remove specific events aClass removeEvent: #whatever triggeredFor: whoever -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
In reply to this post by Ian Bartholomew-19
Hi,
"Ian Bartholomew" <[hidden email]> wrote > What you _can't_ do in the base image, and I've had to add it myself when > needed, is to remove specific events > > aClass removeEvent: #whatever triggeredFor: whoever I'd like to learn how to implement this intricate method to ehhance my st knowledge in Dolphin event mechinery stuff. regards, tkkuo |
Free forum by Nabble | Edit this page |