• 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: Passing C Style Function Callbacks in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing C Style Function Callbacks in Cocoa


  • Subject: Re: Passing C Style Function Callbacks in Cocoa
  • From: Hiro Fujimoto <email@hidden>
  • Date: Sat, 6 Mar 2004 04:57:32 +0900

Vince,

I got an idea that will enable to do you want. Try it.
Before your C-style function to be called back, declare static reference to
your object as below.

static id myObject;

And set it up in initialization or in 'awakeFromNib:'...

myObject = self;

Now, your call back function is able to send any message to the object.

--

On 2004/03/06, at 0:37, Vince Ackerman wrote:

I'm a Object C newbie and hope someone here can help. I need to pass a
function call-back to a C- style function from one of my objects. I
have declared the call-back function before the @implementation MyObj.
The problem I'm having is accessing my object from within the call-back
function, which doesn't seem to know about my object. I want the
callback to send a setter message to my object. I'd rather be able to
pass a call-back that was a method of my object instead. Is there a way
to pass a Obj C style message as a function* in place of the C-style
function???

Thanks in advance

Vince Ackerman


------------------------------------------------------------------------ ---------
hiro FUJIMOTO - developer in Japan.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Passing C Style Function Callbacks in Cocoa (From: Vince Ackerman <email@hidden>)

  • Prev by Date: Proceeding to nextKeyView when a NSTextField is full.
  • Next by Date: Re: Proceeding to nextKeyView when a NSTextField is full.
  • Previous by thread: Re: Passing C Style Function Callbacks in Cocoa
  • Next by thread: RE: Passing C Style Function Callbacks in Cocoa
  • Index(es):
    • Date
    • Thread