Question

My NSPanel window is always on top of all other apps windows. This is how I load it:

[NSApp beginSheet:[self window] modalForWindow:[rootDocument mainWindow] modalDelegate:self didEndSelector:nil contextInfo:nil];

I've tried to change the level with setLevel: and different level types, or using orderBack: or orderFront: . But it seems these methods have no effect, since the window is always on top.

thanks

Was it helpful?

Solution

You do not pass nil, Nil, 0, or NULL to didEndSelector. Ever. You pass a selector to a method (-sheetDidClose:returnCode:contextInfo:) that you have declared. That you are passing something other than a selector makes whatever else you're doing to dismiss the sheet suspect. (You haven't said if the panel stays on top because it's never dismissed, but that's my assumption here.)

Take a look at Using Custom Sheets, which is Apple's own documentation on the subject.

Also, be sure that the panel you are using has its "Visible At Launch" flag turned off in IB.

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