简体   繁体   中英

How to detect if NSStatusItem is displayed in status bar?

My Mac OS X application has a NSStatusItem.

It works fine, however, I just discovered that apparently if there are too many items in the top menu/status bar (for instance, if an app has long menus, there are too many icons, etc.), my status item gets hidden by the system.

How can I detect this in my application, so that I can do something about it?

Thanks

On page 18 of the 26 July 2011 edition of the Mac OS X Human Interface Guidelines (where status items are referred to as "menu bar extras"), it is stated:

Note: If there isn't enough room to display all of the active app's menus, Mac OS X can omit some menu bar extras. If there is still insufficient room to display all menus, some of the app's menus may be omitted, starting with the rightmost menu.

So to answer your question, "(Can I) do something about it?", the answer is: No. You have to think of the menu bar extra as the 'extra' that it is called, an additional convenience. If you really want to use this UI element, you do so by providing one that does not contain commands critical to the user's control of your application. Rather, you should provide those that can be accessed from elsewhere in your application.

This question is pretty much a duplicate of this . There is a very disingenuous solution described in the link for solving your problem though it requires more work than you'd expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM