Re: Position of my item in the statusBar
Re: Position of my item in the statusBar
- Subject: Re: Position of my item in the statusBar
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 17 Sep 2012 15:25:04 -0600
On Sep 17, 2012, at 2:55 PM, Erik Stainsby <email@hidden> wrote:
> HI,
>
> I'm wondering if anyone can explain to me (or point me in the right direction) as to how I can determine the current position of my stats bar item at runtime. It seems that the status bar mechanisms are unpublished except for the very basic use of popping an item into the collection and hanging a menu from it. I'd like to know where on screen my item's image is so that I can place a panel window adjacent to it.
>
> Advice?
The only way I know of doing this involves relying on an implementation detail of status items, so I wouldn't recommend relying on this advice always being true. As of the last few versions of OS X at the time of this writing, status items work by creating a borderless window that belongs to the creating application, so if you set a status item's target, and then cycle through the app's windows to find a window with a contentView with a target that is identical to the status item's target, then that window is the status item's window. You should be able to get the status item's frame from that window.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden