Question

I'm using an NSWindow and set it's level to NSStatusWindowLevel :

[aWindow setLevel:NSStatusWindowLevel];

Now, when I present a sheet (self is my sheet window)

modalAnswer = 0;
[NSApp beginSheet:self modalForWindow:aWindow modalDelegate:self didEndSelector:NULL contextInfo:nil];
[self makeKeyAndOrderFront:nil];

then the window doesn't show up above the dock, it hides underneath (meaning that NSStatusWindowLevel doesn't work anymore). I've tried changing the level of the sheet window, but it won't work.

What's causing this issue?

Was it helpful?

Solution

I asked for technical support and they found it was a silly mistake : sheets normally are modal, but I was making it modal myself too.

The combination of beginModalSessionForWindow and runModalSession is the issue here. It appears to be servicing the default run loop which is causing the menu bar and Dock to appear over your window.

I'm a bit confused as to why you are calling beginSheet:modalForWindow, and then using NSApp's beginModalSessionForWindow. Why do you manually add a modal session? Sheets are automatically modal to whatever window it is attached to. I am used to seeing the use of "beginModalSessionForWindow" without sheets on top of them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top