|
|
NSStatusItem--A poor substitute?
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
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'."
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
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>.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
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>
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
</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.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|