• 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: NSButton with modifier key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSButton with modifier key (From: Matthew Weinstein <email@hidden>)

  • Prev by Date: Re: Eval() ?
  • Next by Date: Re: Eval() ?
  • Previous by thread: NSButton with modifier key
  • Next by thread: does transformedValueClass matter?
  • Index(es):
    • Date
    • Thread