Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
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