How to get the on-screen location of an NSStatusItem?

Give the NSStatusItem a view, then get the frame of that view's window. This technically counts as UndocumentedGoodness, so don't be surprised if it breaks someday (e.g. , if they start keeping the window offscreen instead).

Give the NSStatusItem a view, then get the frame of that view's window. This technically counts as UndocumentedGoodness, so don't be surprised if it breaks someday (e.g. , if they start keeping the window offscreen instead). I don't know what you mean by “could not get heigher then 20px�.

W00t! That helped look @ this debug message 2009-08-19 22:15:43.199 PasteBin14430:a0f X:1118.000000 -- Y:1028.000000 2009-08-19 22:15:43.203 PasteBin14430:a0f X:1118.000000 -- Y:1028.000000 ------ Code here --- - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. NSLog(@"X:%f -- Y:%f", self.window.frame.origin.

X, self.window.frame.origin. Y); } - --- - - -- - - Thanks so much I think that you have solved the mystery for millions of developers right now thanks!. – Johnny Mast Aug 19 '09 at 20:17.

It seems that this app uses Matt's MAAttachedWindow. There's an sample application with the same layout & position.

A custom view breaks some behaviour, it seems, even if I try to imitade an ordinary menu (like the menu not disappearing when clicking another status item. I tried to create a custom view and swap it, get the frame, and swap back, but that doesn't seem to work: -(NSRect)getFrame; { NSView * swap = statusItem view retain; // setView calls release on the current view? StatusItem setView:customView; NSRect frame = customView getFrame; // works perfectly statusItem setView:swap; // nothing happens :( return frame; }.

This doesn't work (I believe) because view is nil before you set the customView. Or something like that. – Max Howell Oct 18 at 22:16.

From the Apple docs: "Setting a custom view overrides all the other appearance and behavior settings defined by NSStatusItem. The custom view is responsible for drawing itself and providing its own behaviors, such as processing mouse clicks and sending action messages.

To do this without the hassle of a custom view, I tried the following (that works). In the method that is set as the action for the status item i.e. The method that is called when the user clicks the status item, the frame of the status item can be retrieved by.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions