• 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: Faceless app showing window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faceless app showing window?


  • Subject: Re: Faceless app showing window?
  • From: Wade Tregaskis <email@hidden>
  • Date: Sat, 13 Mar 2004 15:50:47 +1100

i have an application which runs in the background and creates a
NSStatusItem in the menu bar, my question is how do i make it display a
window? i've tried

[NSApp activateIgnoringOtherApps:YES];
[adminConsole makeKeyAndOrderFront:nil];

I have an app which does this. It creates the window pragmatically, using the following code:

window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];

if (window) {
[window setLevel:(NSMainMenuWindowLevel - 1)];
[window setHasShadow:NO];
[window setAlphaValue:0.75];
[window setOpaque:NO];
[window setMovableByWindowBackground:YES];

[window orderFrontRegardless];
}

This [of course] works fine. I believe the trick is that you have to order the window to front; prior to that it doesn't actually exist on the screen (even if you ask for it not to be deferred, as I do above). If you're working with a window from a nib, it should already be setup, so all you'll need to do is order it to front (i.e it should already have the default level, so you needn't set that yourself).

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Faceless app showing window? (From: email@hidden)

  • Prev by Date: How to get a Category method?
  • Next by Date: Re: How to get a Category method?
  • Previous by thread: Faceless app showing window?
  • Next by thread: Re: Faceless app showing window?
  • Index(es):
    • Date
    • Thread