• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: address of method in a class instance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: address of method in a class instance (From: Andreas Monitzer <email@hidden>)

  • Prev by Date: Re: Why is NSTableView scrolling in Cocoa apps so slow?
  • Next by Date: Re: self and _cmd
  • Previous by thread: Re: address of method in a class instance
  • Next by thread: Re: address of method in a class instance
  • Index(es):
    • Date
    • Thread