Re: address of method in a class instance
Re: address of method in a class instance
- Subject: Re: address of method in a class instance
- From: Robert S Goldsmith <email@hidden>
- Date: Thu, 06 Sep 2001 12:48:53 +0100
Hi :)
1)Have a c function as the callback
2)pass self in the refCon field of the callback setup
3)use this refCon field to message the correct instance of the class
with the iterator the callback returns
4)In the class instance, do what is needed on that event (eg. someone
unplugging the usb device) and send a notification.
5)In the main class instance, listen for this notification and do
things like changing the icon showing whether the usb device is
plugged in or not.
You could skip #2 and #3 and just send the notification from the
C-function. Your class instance could be just another observer.
The notification should only be sent if the usb pipes could
actually build so it needs to be sent after the usb linking
code which is instance dependent. For this reason, i needed
to tell the correct instance to link the usb stuff up and
test it before sending a notification.
This is also why I could not use a class method, as Ondra
suggested - it is all instance dependent.
Robert