• 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: Popup menu on button click
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Popup menu on button click


  • Subject: Re: Popup menu on button click
  • From: "Alan Smith" <email@hidden>
  • Date: Fri, 29 Dec 2006 09:27:30 -0500

It's fun, and easy! :-)

Subclass NSButton and override mouseDown and mouseUp.

- (void)mouseDown:(NSEvent*)event
{
 [self setHighlighted: YES];

 [NSMenu popUpContextMenu: [self menu] withEvent: event forView: self];
}
- (void)mouseUp:(NSEvent*)event
{
 [self setHighlighted: NO];
}

Note: I didn't test this code, it was written in Safari.

Peace, Alan


-- // Quotes from yours truly ------------------------- "You don't forget, you just don't remember." "Maturity resides in the mind." "Silence is the Universe's greatest gift." "When the World realizes that religion really is unnecessary, then it shall evolve." _______________________________________________

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: 
 >Popup menu on button click (From: "Ferhat Ayaz" <email@hidden>)

  • Prev by Date: Popup menu on button click
  • Next by Date: NSCFArray beyond bounds
  • Previous by thread: Popup menu on button click
  • Next by thread: Re: Popup menu on button click
  • Index(es):
    • Date
    • Thread