Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is an NSNextStepFrame?




I figured it out. Below is the code that I am using to position a panel near my NSStatusItem's location. The first method returns an NSPoint of the origin of my NSStatusItem's window. The second uses that point (if it's not 0,0) to move the NSPanel to be right under the NSStatusItem. The first time it's used, I can see the panel move to the location of the NSStatusItem. Subsequent times, it just appears there, as it's saving its last location to preferences.



/** * statusItemOrigin * Figures out the location of our NSStatusItem */ -(NSPoint)statusItemOrigin { NSView *o =(NSView *)[appMenuButton superview];

NSWindow *w = [o window];
if (w)
{
// NSLog(@"4 origin: %f,%f", [w frame].origin.x,[w frame].origin.y);
// NSLog(@"4 size: %f,%f", [w frame].size.width,[w frame].size.height);
return [w frame].origin;
}
return NSPointFromString(@"{0,0}");
}



/** * showRunPanel * Displays the "run" panel */ -(void)showRunPanel:(NSMenuItem *)item { // Get location of my NSStatusItem NSPoint o = [self statusItemOrigin];

    NSLog(@"showRunPanel");

    // Bring window to front and display
    [runPanel orderFrontRegardless];
    [runPanel makeKeyWindow];
    [runPanel display];

    // move to under NSStatusItem
    if (o.x>0 && o.y>0)
    {
        NSLog(@"move panel to %f, %f", o.x, o.y);
        [runPanel setFrameTopLeftPoint:o];
    };
};




On Aug 13, 2005, at 1:21 PM, Michael Rothwell wrote:

I am attempting to fid out where my NSStatusItem view (an NSButton) lives on the screen, so that I can place a popup window close to it.

The NSButton reports that its superview is an NSNextStepFrame, from which I cannot get a frame. It doesn't seem to behave like an NSView.

I don't really know what an NSNextStepFrame is. Does anyone else?

-Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >What is an NSNextStepFrame? (From: Michael Rothwell <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.