NSStatusItem (cocoa) location on screen

Posted by Craig on Stack Overflow See other posts from Stack Overflow or by Craig
Published on 2009-11-09T22:00:50Z Indexed on 2010/03/27 11:33 UTC
Read the original article Hit count: 505

Filed under:
|

I am trying to get the on screen location of an NSStatusItem so that I can perform a click on that area via code like below. I am doing this so that my users can press a hotkey to see the menu.

event = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, newLocation, kCGMouseButtonLeft);
CGEventPost(kCGHIDEventTap, event);
CFRelease(event);

Does anyone know of a way to get the location?, I have been trying ideas and searching for days and have found several ideas but none of them seem to work in leopard/snow leopard

The NSStatusItem is using an NSMenu not a custom view.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsstatusitem