On Jan 5, 2011, at 11:15 PM, deovrat singh wrote:

> If I put NSNormalWindowLevel , then on clicking any other window of my
> application this window goes in background.While if I use any other level
> than NSNormalWindowLevel , then the window remains topmost even if I switch
> to some other application. I want the window to be topmost only when my
> application is active.How to do this in cocoa ?

Use the correct window level.  Obviously NSScreenSaverWindowLevel is going to 
appear above any normal window regardless of the current application. Only 
NSNormalWindowLevel and NSFloatingWindowLevel apply to leveling within the 
current application. If you want a window to float above all others of the same 
level, you can pretty much get away with using level + 1.


Other than that, some ideas are:

1) perhaaaaaps what you might want is a child window. If you add a window as a 
child of another, you can force it to always be ordered above or below it.

2) Call orderFrontRegardless when it's ordered out?

3) Intercept sendEvent and call NSApplication's preventWindowOrdering?


You'll have to tinker, but the window level is the right solution and should 
work fine.


--
Seth Willits



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to