• 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: iTunes-like behaviour of NSButton with NSAlternateKeyMask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask


  • Subject: Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
  • From: Murat Konar <email@hidden>
  • Date: Fri, 09 Feb 2007 11:41:57 -0800


On Feb 9, 2007, at 10:05 AM, Michael G. Ströck wrote:

Hi,

I've been trying to implement a button that changes its icon and action according to whether the Option key is being held down. There are numerous solutions on the web and in the archives, but all of them seem to be wrong. Unless your application is the currently active one, all of these solutions --which override flagsChanged or sendEvent in some NSResponder subclass-- break.

iTunes and iPhoto keep monitoring the status of the Option key even when they're in the background, and I can't figure out how it's done. Can anybody here on the list give me any pointers?

Try this:

#import <Carbon/Carbon.h>

BOOL optionKeyIsDown()
{
	return (GetCurrentKeyModifiers() & optionKey) != 0;
}


_murat_______________________________________________

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


  • Follow-Ups:
    • Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
      • From: "Michael G. Ströck" <email@hidden>
References: 
 >iTunes-like behaviour of NSButton with NSAlternateKeyMask (From: "Michael G. Ströck" <email@hidden>)

  • Prev by Date: Old-style coordinates vs new
  • Next by Date: Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
  • Previous by thread: Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
  • Next by thread: Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
  • Index(es):
    • Date
    • Thread