• 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: C Callback to update Cocoa UI elements - how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C Callback to update Cocoa UI elements - how?


  • Subject: Re: C Callback to update Cocoa UI elements - how?
  • From: Raphael Sebbe <email@hidden>
  • Date: Thu, 9 May 2002 20:26:02 +0200

Have a look at http://www.stepwise.com/Articles/Technical/2001-03-20.01.html . There you'll find what you need, see SUSpeaker class and associated callback functions (NSPort communication with the main runloop). Functions defined in ObjC implementation files (.m) are regular C functions (unlike C++, parameter passing... ), with the difference you can invoke ObjC methods in them.

Hope this helps,

Raphael

On Thursday, May 9, 2002, at 07:54 PM, ruffnex wrote:

Hi,

I have a C library function which is asynchronous (kicks off a thread) and accepts a C callback fn. The callback fn is invoked continuously, each time receiving some status info.

I would like to display this dynamic status info in my GUI e.g. NSTextField.
My problem is what code to put in the C callback function to be able to update the Cocoa UI controls.

Should I use an event mechanism to notify the main NSApplication thread e.
g. PostEvent: ? I believe that this should be MT-Safe. Does anybody have experience at this and could highlight any caveats?

What other approaches can you think of? What's the best approach in terms of ease of implementation? Are there complications due to the Obj-C runtime?

Your feedback is appreciated - thank you.

Rgds,

Simon
_______________________________________________
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.
_______________________________________________
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: 
 >C Callback to update Cocoa UI elements - how? (From: ruffnex <email@hidden>)

  • Prev by Date: Re: DO and Proxy Indirection
  • Next by Date: Re: Saving NSColor
  • Previous by thread: C Callback to update Cocoa UI elements - how?
  • Next by thread: Re: Snap-to-edge palettes / dragging windows
  • Index(es):
    • Date
    • Thread