Re: Popup menu on button click
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