• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Making a window topmost within an application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making a window topmost within an application


  • Subject: Re: Making a window topmost within an application
  • From: Seth Willits <email@hidden>
  • Date: Thu, 6 Jan 2011 00:40:03 -0800

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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Making a window topmost within an application (From: deovrat singh <email@hidden>)

  • Prev by Date: Re: Making a window topmost within an application
  • Next by Date: Re: execute system("some script") on behalf of root from non-root app
  • Previous by thread: Re: Making a window topmost within an application
  • Next by thread: Re: Making a window topmost within an application
  • Index(es):
    • Date
    • Thread