• 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
Displaying Cocoa NIBs from Carbon?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying Cocoa NIBs from Carbon?


  • Subject: Displaying Cocoa NIBs from Carbon?
  • From: "Patrick M" <email@hidden>
  • Date: Wed, 21 Mar 2007 11:38:55 -0400

I have a carbon application that displays several windows.

I am adding a feature to display another window and I would like to use the
nice Cocoa NIB stuff to make my life easier, but I cannot seem to get the
Cocoa NIB to load properly from my carbon code.

I have investigated this and found the Apple "
http://developer.apple.com/samplecode/CocoaInCarbon"; sample that was no
help.

I get an error on the CreateWindowFromNib call, it returns -10, and I have
only seen ONE reference to this error for this function in all my searches,
what does this error mean and can I even get a full featured Cocoa NIB to be
displayed using Carbon APIs in manner attempted below?

Failing that, is there any better documentation about the differences
between Carbon and Cocoa NIBs (other than the obvious: Carbon requires an
explicit handler and Cocoa does not).

I do not want to call the NIB functions from Carbon (as is done in the
sample), I want the Cocoa NIB to handle all messages and have control return
to the function below after the user is finished interacting with the Cocoa
window/dialog.  The window/dialog will update things (data etc...) as
needed, and the calling function below does not need to know what was done
at all.

The Nib "MyNib"  and the window "MyWindow" in the nib do exist.

void showWindow() {

   IBNibRef            nibRef;
   WindowRef            windowRef;
   OSStatus            retError = noErr;

  if (noErr == CreateNibReference(CFSTR("MyNib"), &nibRef)) {
       if (noErr == (retError = CreateWindowFromNib(nibRef,
CFSTR("MyWindow"), &windowRef))) {
           ShowWindow(windowRef);
           BringToFront(windowRef);
           RunAppModalLoopForWindow(windowRef);
           HideWindow(windowRef);
           DisposeWindow(windowRef);
       }
       DisposeNibReference(nibRef);
   }
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: Displaying Cocoa NIBs from Carbon?
      • From: Eric Schlegel <email@hidden>
  • Prev by Date: Re: Embedding a WebView in a Table
  • Next by Date: Application Caches
  • Previous by thread: Re: How can I combine 2 data buffers?
  • Next by thread: Re: Displaying Cocoa NIBs from Carbon?
  • Index(es):
    • Date
    • Thread