• 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
NSStatusItem custom view with menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSStatusItem custom view with menu


  • Subject: NSStatusItem custom view with menu
  • From: Jacob Bandes-Storch <email@hidden>
  • Date: Thu, 3 Jul 2008 17:46:35 -0700

I'm making an NSStatusItem with a custom view. In drawRect:, it draws things based on the value of the "highlighted" instance variable. When mouseDown: is called, it pops up a menu using the status item's popUpStatusItemMenu: method. Using the mouseUp: event does not work, because it is not called after the menu goes away. This is the way I've found that makes it work:

- (void)mouseDown:(NSEvent *)theEvent {
	highlighted = YES;
	[self setNeedsDisplay:YES];
	[statusItem popUpStatusItemMenu:menu];
	highlighted = NO;
	[self setNeedsDisplay:YES];
	[super mouseDown:theEvent];
}

Is this a good method, or is there something better that involves mouseUp:?
_______________________________________________


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: NSStatusItem custom view with menu
      • From: "Michael Ash" <email@hidden>
    • Re: NSStatusItem custom view with menu
      • From: Andy Kim <email@hidden>
  • Prev by Date: Crashes with no backtrace when printing
  • Next by Date: NSTextView and Spell Checking with a layer backed view
  • Previous by thread: Re: Crashes with no backtrace when printing
  • Next by thread: Re: NSStatusItem custom view with menu
  • Index(es):
    • Date
    • Thread