Event loop in a secondary thread? Nibless Cocoa?
Event loop in a secondary thread? Nibless Cocoa?
- Subject: Event loop in a secondary thread? Nibless Cocoa?
- From: Bruce Sherwood <email@hidden>
- Date: Sat, 03 May 2008 19:35:47 -0400
I'm new to (modern) Mac programming. There seem to be two major
show-stoppers to what I need to do, and I'd be grateful to be told how
to get around these seemingly impenetrable barriers. I posted a similar
question on the carbon-dev list and got some useful advice, and now I'm
asking the advice of the Cocoa community.
Visual is a 3D graphics module for Python; the combination is called
VPython (see vpython.org). Visual, which is written in multithreaded
C++, can be imported dynamically at any time in a Python program. Visual
then has to start up an event loop to make a window and process events.
First, it appears impossible to start either a Cocoa or Carbon event
loop from a secondary thread, which I think I need to do in the Visual
situation. We're not building an application, we're building an
importable module. (In tests we ran, we ran into similar problems with
PyObjC.)
Second, I don't see any way to access a Nib file in this situation. I
think my event loop has to be implemented in a nibless way. I'm not
building a free-standing bundled application. After a fair amount of
blood on the floor (since there is no or wrong or out-of-date
documentation on how to do this with Carbon, and/or the things
recommended turn out to be deprecated when tried), I did succeed in
making a nibless Carbon proof of concept.
I found a series of articles on nibless Cocoa, but these articles assume
far more knowledge than I currently have, and the scheme seems to depend
on undocumented tricks and kludges that are unlikely to be stable:
http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu
Is there an approved way to work with Cocoa without a Nib file? Or
equivalently is there a way to specify a location where the Nib file can
be found? Visual won't be a bundled application, so presumably the Nib
file won't be found in a standard place.
Bruce Sherwood
P.S. Until now the Mac version of Visual has been built on GTKmm and
requires Fink and X11, which makes VPython difficult to install for
nonexpert Mac users. We very much want a native-mode version of Visual.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden