Displaying Cocoa NIBs from Carbon?
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