aneuryzm
aneuryzm

Reputation: 64854

NSPanel is always on top of all other app windows

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

Upvotes: 1

Views: 672

Answers (1)

Extra Savoir-Faire
Extra Savoir-Faire

Reputation: 6036

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.

Upvotes: 1

Related Questions