• 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: Position of NSStatusItem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Position of NSStatusItem


  • Subject: Re: Position of NSStatusItem
  • From: Joachim Deelen <email@hidden>
  • Date: Tue, 20 Nov 2007 22:57:05 +0100

Hi Fabian,

since this is an international, english list, I think we should write english here. Even though my mother tongue is german too...

You can't create a View for the StatusItem with that size: The max height of the MenuBar is 22px. So I thing creating a view with a height of 50 will fail.

It's better to use the following:

[[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, [statusBarItem length], [[statusBarItem statusBar] thickness])]

This takes the actual length of created StatusItem and the thickness of the MenuBar into account.

Hope this helps

Joachim

Am 20.11.2007 um 22:40 schrieb [nexUmoja] Fabian Jäger:

Hallo Joachim,
erstmal danke für deinen Versuch mir zu helfen. Ich habe folgenden Code:


// instantiate statusbar-icon
NSStatusBar *systemBar = [NSStatusBar systemStatusBar];
theItem = [systemBar statusItemWithLength: NSVariableStatusItemLength];
[theItem retain];
NSView *tmpView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 50, 50)];
[theItem setView:tmpView];

NSRect globalOrigin = [[[theItem view] window] frame];
NSLog(@"%f/%f", globalOrigin.origin.x, globalOrigin.origin.y);

[theItem setView:nil];
[tmpView release];


Leider bekomme ich immer x=-22 und y=0 als Ergebnis. Ich habe keine Ahnung, woran das liegt :(

Fabian


On 20.11.2007, at 22:11, Joachim Deelen wrote:

Hi Fabian,

I'm currently working on an application, using a NSStatusItem with a custom view. With the following I can get the origin of the NSStatusItem

NSRect rect = [[[statusItem view] window ] frame];

Since I'm on a 24" iMac, the origin is about x=1525 y=1178

I don't know if this works, if you don't use a custom view.

regards
Joachim

_______________________________________________

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


  • Follow-Ups:
    • Re: Position of NSStatusItem
      • From: "[nexUmoja] Fabian Jäger" <email@hidden>
References: 
 >Position of NSStatusItem (From: "[nexUmoja] Fabian Jäger" <email@hidden>)
 >Re: Position of NSStatusItem (From: Joachim Deelen <email@hidden>)

  • Prev by Date: "Cue Sheet Parser" - Use NSString?
  • Next by Date: Re: Position of NSStatusItem
  • Previous by thread: Re: Position of NSStatusItem
  • Next by thread: Re: Position of NSStatusItem
  • Index(es):
    • Date
    • Thread