• 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
Popping open a status item menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Popping open a status item menu


  • Subject: Popping open a status item menu
  • From: Pierre Bernard <email@hidden>
  • Date: Wed, 6 Feb 2008 17:47:11 +0100

Hi!

I would like to programmatically pop open the menu attached to a NSStatusItem.

At first sight, NSStatusItem, provides the perfect API:

	- (void)popUpStatusItemMenu:(NSMenu*)menu;

The result of this call however is not perfect: the menu open at exact the right location. Yet the menu item in the menu bar is not highlighted.

Thus this is only marginally better than opening the menu as a contextual menu:

[NSMenu popUpContextMenu:[self statusMenu] withEvent:theEvent forView:nil withFont:nil];

The stack trace leading to -viewDidMoveToWindow when accessing the menu using the mouse, has this promising private method listed:

	- [NSStatusBarButtonCell popupStatusBarMenu:inRect:ofView:withEvent:]

To call that I would need to figure out how to get to the NSStatusBarButtonCell. Then I wonder what this method expects for a NSRect.

TIA for suggestions, thoughts and hints.

Pierre

---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Prev by Date: Re: Apples's code examples... Poor coded or it is just me?
  • Next by Date: Re: Use of Mac OS X 10.5 / Leopards Garbage Collection Considered Harmful
  • Previous by thread: Re: Transferring data between Python and Cocoa (maybe a newbie question)
  • Next by thread: Memory management problem
  • Index(es):
    • Date
    • Thread