[FIX] Publish-subscribe event system
Stefan Matthias Aust
sma at 3plus4.de
Sun Apr 23 14:35:07 UTC 2000
At 16:56 17.04.00 +0000, you wrote:
>Stefan, do you have any examples on using the publish-subscribe event
>system? I'm looking for some toy examples to get a feel for how to
>use it and what it affords.
Unfortunately, not at the moment. The system is very similar to the usual
update/changed mechanism although a little bit more efficient. See
Object's events protocol for all methods. Use
when: anEventSymbol send: aSelector to: anObject
to register "anObject" as a listener (to use the Java jargon) for
"anEventSymbol". Let's say you've an application which is interested in
mouse clicks and a button widget which can trigger #clicked events. Then
you'd use
button when: #clicked send: #buttonClicked to: application
to register the listener and then provide a method
Application>>buttonClicked which will be called then. The button will
eventually trigger events using
trigger: anEventSymbol
Variants of these methods are used to pass arguments from the event source
to the event handler method.
bye
--
Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf
More information about the Squeak-dev
mailing list
|