• 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 + optionkey?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton + optionkey?


  • Subject: Re: NSButton + optionkey?
  • From: glenn andreas <email@hidden>
  • Date: Sat, 20 Aug 2005 09:20:02 -0500


On Aug 20, 2005, at 7:52 AM, Theodore H. Smith wrote:

How do I detect if the user is holding the optionkey down, while clicking on an NSButton?

I tried this:

    unsigned int f = [[NSApp currentEvent] modifierFlags];
    BOOL optKeyDown = f & NSAlternateKeyMask;
    return optKeyDown; //

that didn't work, though, it always returned false.

This does work correctly, but you're getting caught by C issues.

Consider this:

    int f = 4 bytes (say, oh, 0x00080000)
    NSAlternateKeyMask = 1 << 19;

    typedef signed char BOOL;

Bitwise anding of "f & NSAlternateKeyMask" is 0x00080000.

Store that 4 byte value in a signed char - what do you get?





Glenn Andreas                      email@hidden
 <http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets

_______________________________________________
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 + optionkey? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Reporting errors from key-value-coding accessors
  • Next by Date: NSTableView not letting me double-click rows always?
  • Previous by thread: NSButton + optionkey?
  • Next by thread: NSTableView not letting me double-click rows always?
  • Index(es):
    • Date
    • Thread