Hello everyone. I'm just changing the title of a previous thread, as my
problems were narrowed down from general NSSavePanel modality, into a
(possibly) bug in the OS.
The problems occur whenever I try to display a NSSavePanel as a sheet over a
Carbon window.
- (void) saveCarbonWindow: (WindowRef) carbonWin
{
NSWindow *cocoaWrap = [[NSWindow alloc] initWithWindowRef: carbonWin]];
NSSavePanel *myPanel=[NSSavePanel savePanel];
[myPanel beginSheetForDirectory:nil file:nil ......
}
No matter what NSSavePanel API I use (10.6 with codeblock completion handler,
10.5 with didEnd selector, or even runModal) I get strange behaviors.
1. Sometimes the sheet will be displayed BEHIND its parent (carbon originated)
window. In such cases, the program hangs as the sheet is still key, but I cant
dismiss it, because the parent (carbon) window is blocking the events sent to
it.
2. Most every time it will be displayed in a WRONG PLACE i.e. the sheet is
centered on screen instead of attached to the carbon window). This is
especially evident when I try to block after creating the NSSavePanel using
[NSApp runModalForWindow:myPanel]; In the docs it says that this will center a
window if it is not visible, but my panel IS visible BEFORE i call on
runModalForWindow.
3. Sometimes the Save/Cancel (or Open/Cancel in case of NSOpenPanel) will do
nothing --- as if someone is eating up the events). In that case the didEnd or
Completion handler will never be called.
Many other weirdnesses happen, and in the Debugger console I can many time
detect errors concerning the window-ordering of these windows. Things like..
Mon Oct 26 10:31:18 BlancVox.local NavTester[1110] <Error>:
kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 187
Mon Oct 26 10:31:18 BlancVox.local NavTester[1110] <Error>:
kCGErrorIllegalArgument: CGSOrderFrontConditionally: Invalid window
The whole Carbon/Cocoa window binding is very obscure, and I can not find good
guide for matching the two together.
Another important note: I get the same (well... minor modification...) behavior
when I use Carbon Navigation Services API's, on Leopard and Snow Leopard. I saw
in the docs that as of Leopard Navigation Services are Cocoa-based, so that
might explain this behavior.
I saw in the debugger that the actual class of the cocoaWrap is NSCarbonWindow
which is not documented at all, and I simply do not know what to do --- Am I
missing a critical configuration of the carbon window that I need to do before
attaching an NSSavePanel to it?
Maybe there is a real bug in the OS that I'm not aware of?
Please help.
Motti Shneor
------------------------------------------
Senior Software Engineer
Waves Audio ltd.
Phone: +972-3-6094415
Mobile: +972-54-4470730
[mailto: [email protected]]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]