Re: NSButton with modifier key
Re: NSButton with modifier key
- Subject: Re: NSButton with modifier key
- From: Ricky Sharp <email@hidden>
- Date: Thu, 2 Mar 2006 21:24:12 -0600
On Mar 2, 2006, at 8:54 PM, Matthew Weinstein wrote:
I want to have my program respond to a button click differently
depending on whether the option key or command key or no key is
pressed when the button is pressed. I can't figure out how to
detect whether a key is pressed, however. keyEquivalentModifierMask
doesn't seem to do it; it just returns 0 each time. :-( It's got to
be obvious, but somehow I'm not finding out how my action method
can examine sender to find out if any modifiers were clicked.
Here's an example that will do something different for the option
(alt) key...
- (IBAction)someAction:(id)sender
{
if (([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) !
= 0)
// do special action
else
// do normal action
}
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden