0

I used the Cocoa "Status Bar" tutorial (http://cocoatutorial.grapewave.com/tag/status-bar/) as a starting point in an attempt to build myself an agent that only appears as a StatusItem.

This application has no main NSWindow object, and it has three NSPanels associated with it. One NSPanel functions as an Application Preferences window, and the other two simply prompt the user to enter a short bit of text with an OK button.

The preferences panel is launched through an NSMenuItem, like so:

NSMenuItem *showPrefsMI = [[NSMenuItem alloc] initWithTitle:@"Show Prefs" action:@selector(makeKeyAndOrderFront:) keyEquivalent:@""];
[showPrefsMI setTarget:prefsPanel];
[menu addItem:showPrefsMI];

When I build and run the application from inside XCode, everything seems to work just fine. However, when I run the application from outside of Xcode, like from the Finder, these windows simply do not appear at all.

In addition, I am able to duplicate the behavior from within XCode. If I display the preferences panel, and then click off it (say, for example, I click on this Safari window), the preferences panel simply disappears, never to be seen again. I have to physically stop the application from within XCode and then run it again in order to get the Preferences Panel to re-appear.

Thanks in advance for anyone's help!

Ned W.
  • 163
  • 1
  • 6
  • Tip: check your NSPanels in IB and set all the properties so they do not disappear when the app is in the background. –  Dec 08 '12 at 10:20
  • @DigiMonk, I'm not seeing any settings that would indicate this type of preference in IB. I'm looking at the Attributes Inspector for both the NSPanel Object and the View that is grouped beneath it. Here is a screen shot of the options I have available: XCode ScreenShot – Ned W. Dec 10 '12 at 18:12
  • 1
    It's the "Hide On Deactivate" Checkbox under "Behaviour" which u should disable. –  Dec 10 '12 at 20:25
  • @DigiMonk thank you for that. Now, the window won't disappear. I can't Command-Tab to it or anything, but if I minimize the other windows I can see it. What is interesting here is that I am using @selector(makeKeyAndOrderFront:). It would appear that it is neither making key nor ordering front. – Ned W. Dec 11 '12 at 00:52

0 Answers0