Reputation: 24737
I want my NSWindow to show new window(s) that will always be on top of current window. they should NOT be on top of other windows.
In addition, they should not move when the original window moves.
How can i do that?
Upvotes: 7
Views: 7318
Reputation: 5023
This worked for me, hope that will be helpful
[self.window makeKeyAndOrderFront:nil];
[self.window setLevel:NSStatusWindowLevel];
Upvotes: 2
Reputation: 2925
Use NSWindow
's addChildWindow:ordered:
or setParentWindow:
method to add the other window as a child of the first window. That window will follow the first window around. See the NSWindow Class Reference.
Upvotes: 5
Reputation: 3294
You can set window level to NSFloatingWindowLevel so it always be on top.
To prevent window from covering other applications you can set its level to NSNormalWindowLevel or you can hide it at all. Try to use applicationWillResignActive: method (NSApplicationDelegate Protocol) to remove your window from top. To catch the moment when you shoud bring your window back on top use applicationWillBecomeActive: method.
Upvotes: 3