• 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
detecting an option-click on a button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

detecting an option-click on a button


  • Subject: detecting an option-click on a button
  • From: Paul Archibald <email@hidden>
  • Date: Thu, 30 Oct 2008 14:51:13 -0700

Is there a simple way to detect that the option key was down when a button was clicked? I have a method in my controller that gets the button click, of course, and I have been trying this:

-(IBAction) handleButton:(id)sender {

	if( [[NSApp currentEvent] modifierFlags] && NSAlternateKeyMask ) {
		// handle option + click
	}
	else {
		// do normal stuff
	}
}

but of course the currentEvent is not necessarily related to the sender. In fact, I realize there is no reason to think that there should be any information about the keyboard status in the sender parameter.




_______________________________________________

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: detecting an option-click on a button
      • From: "Sean McBride" <email@hidden>
    • Re: detecting an option-click on a button
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Image from font file
  • Next by Date: Re: Silicon Valley CocoaHeads ... ?
  • Previous by thread: Re: NSTask and get results
  • Next by thread: Re: detecting an option-click on a button
  • Index(es):
    • Date
    • Thread