Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSStatusItem--A poor substitute?

NSStatusItem--A poor substitute?
Thread Tools
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 14, 2002, 05:24 AM
 
This has been bugging me for a while. I was working on an app a while ago that I wanted to display a list in the menu bar. Not feeling like trial-and-erroring the Menu Extra API from class-dump, I decided to use NSStatusItem. But ridiculously enough, the menu it creates doesn't seem to actually be global. When you click on it, it brings my program to the front, or (if I've made my program GUI-less) at least makes the current app lose focus. This is about as inelegant a solution as I could possibly think of.

So I was wondering: Does anybody else have this sort of problem with status items, or am I doing something wrong? I can't see anything that seems wrong with the code, but I can't believe this is how Apple meant for it to work.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
seb2
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jul 14, 2002, 06:46 AM
 
as always, there are pros and cons. you're right that it's extremely annoying that statusitems make other apps lose focus.
but there are worse examples; change the screen brightness or the volume and then click on the small picture that's about to fade out. you're giving focus to loginwindow...

they do have a few advantages, tough: since they're "real" applications, they can open their own windows -- something a .menu can't do as far as i know; look at the workarounds of weatherpop (loading an app from the resources) or process wizard (having a demon run in the background).

also, if they crash, they don't take the entire systemui server down with them. and apps do crash as soon as they're doing more fancy stuff than adding up two integers.

i wrote a few statusitems apps for myself and am currently working on one which i'm about to publically release (nothing exciting), they're not too bad.

if you want to find out about .menu without having to reverse-engineer class-dumped stuff , look at <a href="http://sourceforge.net/projects/x-asm/" target="_blank">asm's source</a>.
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jul 14, 2002, 07:47 PM
 
The problem you are describing is a bug in 10.1. There is a workaround here:
<a href="http://developer.apple.com/qa/qa2001/qa1081.html" target="_blank">http://developer.apple.com/qa/qa2001/qa1081.html</a>
     
seb2
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jul 14, 2002, 08:41 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Angus_D:
<strong>The problem you are describing is a bug in 10.1. There is a workaround here:
<a href="http://developer.apple.com/qa/qa2001/qa1081.html" target="_blank">http://developer.apple.com/qa/qa2001/qa1081.html</a></strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">works if the statusitem itself was clicked, not if you put up a dialog box and a button was clicked.
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jul 15, 2002, 04:49 PM
 
You'd need to set LSUIElement to 1 in your Info.plist in order for your app not to appear in the dock and for windows associated with it to exist in a global context type thing.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:08 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,