1

My application makes use of an NSStatusItem. I need to grab the screen coordinates for the status item, but since I have no need for the functionality offered by setting a custom view for the item I am using a standard icon-based one instead.

Is there a way to get the status item's position without having to resort to setting a custom view to it?

John Wells
  • 1,139
  • 1
  • 10
  • 27
  • Check out [this][1] answer to a similar question [1]: http://stackoverflow.com/questions/1301701/how-to-get-the-on-screen-location-of-an-nsstatusitem/9927231#9927231 – Steg Mar 29 '12 at 14:20

1 Answers1

0

Unless you find a better way, you could use some undocumented API: - (id)_window of NSStatusItem probably returns the window enclosing the item itself. Maybe you can get some interesting information out of that?

Beware: Some fundamentalists might actually try to break your neck for using undocumented API. Just make sure you check regularly if this portion of your code works with newer OS versions (either by hand or using some unit tests).

Fabian Schuiki
  • 1,268
  • 7
  • 18