7

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?

Erik Sapir
  • 23,209
  • 28
  • 81
  • 141

3 Answers3

5

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.

spudwaffle
  • 2,905
  • 1
  • 22
  • 29
3

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.

VenoMKO
  • 3,294
  • 32
  • 38
2

This worked for me, hope that will be helpful

[self.window makeKeyAndOrderFront:nil];
[self.window setLevel:NSStatusWindowLevel];
Mrug
  • 4,963
  • 2
  • 31
  • 53