Skip navigation.
 
mlRe: Position of NSStatusItem
FROM : [nexUmoja] Fabian Jäger
DATE : Sat Nov 24 03:18:31 2007

Hey,
I tried several solutions on different Macs now and it seems to be a 
problem of Tiger 10.4.11, because on Leopard it works fine without 
any problems, but in Tiger I always get the same (wrong) results ...

Fabian

On 23.11.2007, at 23:26, Joachim Deelen wrote:

> For me it's working flawlessly. I can't expose the complete code 
> but I did something like the following
>
> @interface StatusView : NSView {
>
>     NSStatusItem *statusItem;            //!< The Status Area within the Menu-Bar
> }
> - (id)initWithStatusItem:(NSStatusItem*)statusBarItem;
>
> @end
>
> @implementation StatusView
>
> - (id)initWithStatusItem:(NSStatusItem*)statusBarItem
> {
>     self = [super initWithFrame:NSMakeRect(0.0, 2.0, [statusBarItem 
> length], [[statusBarItem statusBar] thickness])];
>     
>     if(self != nil) {
>         statusItem = statusBarItem;
>         [self setWantsLayer:YES];
>         [statusItem setView:self];
>     }
>     return self;
> }
>
> @end
>
> In some other Class the View and the Status Item are created:
>
> - (void)awakeFromNib
> {
>     NSStatusBar *systemStatusBar = [NSStatusBar systemStatusBar];
>     statusItem = [systemStatusBar statusItemWithLength:[userDefaults 
> integerForKey:kPWPreferenceSize]];
>     [statusView initWithStatusItem:statusItem];
> }
>
>
> I get the position on screen with the following:
>
> NSRect rect = [[self.statusView window] frame];
>
> The position is returned in absolute Screen coordinates. I really 
> don't see your problem ;-(
>
> BTW: I'm using Garbage-Collection so you won't see any retain/
> release or autorelease.
>
> regards
> Joachim

Related mailsAuthorDate
mlPosition of NSStatusItem [nexUmoja] Fabian… Nov 19, 23:14
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 22:11
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 22:57
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 20, 23:03
mlRe: Position of NSStatusItem Joachim Deelen Nov 20, 23:34
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 20, 23:59
mlRe: Position of NSStatusItem Peter Maurer Nov 22, 09:09
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 22, 11:37
mlRe: Position of NSStatusItem Joachim Deelen Nov 23, 23:26
mlRe: Position of NSStatusItem [nexUmoja] Fabian… Nov 24, 03:18