I open a window with the following:
NSRect screenRect = [[NSScreen mainScreen] frame];
[super initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
int windowLevel = CGShieldingWindowLevel();
[self setLevel:windowLevel];
... therefore the window is full-screen and, above all, other window levels (including modal windows). Later, I want to display an open panel, however the following opens a dialog box below the window that I created above (it seems that the runModal element overrides the requested level of the window that I am trying to set):
NSOpenPanel *OP = [NSOpenPanel openPanel];
int windowLevel = CGShieldingWindowLevel();
[OP setLevel:windowLevel];
int returnCode = [OP runModal];
... and the following opens the sheet in the window created above (good), however, it also completes the display of the menu bar that I previously hid (not what I want):
NSOpenPanel *OP = [NSOpenPanel openPanel];
[OP beginSheetModalForWindow:[self window]
completionHandler:^(NSInteger returnCode) {
NSLog(@"completionHandler called with %d", returnCode);
}];
... so my questions are:
- Does anyone know how to open a modal window above
CGShieldingWindowLevel? - Is there a way to make the menu bar not appear on the sheet solution I'm trying to do above?
Thanks to everyone :-)