• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSStatusItem position problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStatusItem position problem


  • Subject: Re: NSStatusItem position problem
  • From: Andy Lee <email@hidden>
  • Date: Mon, 26 Mar 2007 18:46:43 -0400

On Mar 26, 2007, at 6:02 PM, Orr Philip wrote:
I can then access the _fWindow ._frame point and size variables by directly accessing the memory location relative to the windows memory address and rebuilding the needed NSRect, see below:

INF_StatusItem *menubarItem = (INF_StatusItem *) statusItem;
NSPoint *itemPoint = (NSPoint *) menubarItem->fWindow + 1;
NSSize *itemSize = (NSSize *) menubarItem->fWindow + 2;
NSRect itemRect = NSMakeRect(itemPoint->x, itemPoint->y, itemSize- >width, itemSize->height);
NSLog(@"AppController:statusItem with x = %f, y = %f, width = %f, height = %f.", itemRect.origin.x, itemRect.origin.y, itemRect.size.width, itemRect.size.height);

Instead of hacking pointers, you can add a one-line category method on NSStatusItem. No subclass needed.


@interface NSStatusItem (Hack)
- (NSRect)hackFrame;
@end

@implementation NSStatusItem (Hack)
- (NSRect)hackFrame
{
    return [_fWindow frame];
}
@end

--Andy

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >NSStatusItem position problem (From: Orr Philip <email@hidden>)
 >Re: NSStatusItem position problem (From: Jake Sprouse <email@hidden>)
 >Re: NSStatusItem position problem (From: Orr Philip <email@hidden>)
 >Re: NSStatusItem position problem (From: Uli Kusterer <email@hidden>)
 >Re: NSStatusItem position problem (From: Orr Philip <email@hidden>)
 >Re: NSStatusItem position problem (From: Uli Kusterer <email@hidden>)
 >Re: NSStatusItem position problem (From: Orr Philip <email@hidden>)

  • Prev by Date: Re: "save as" in a document based app
  • Next by Date: Re: "save as" in a document based app
  • Previous by thread: Re: NSStatusItem position problem
  • Next by thread: Re: NSStatusItem position problem
  • Index(es):
    • Date
    • Thread