• 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 12:25:47 -0800


On Feb 9, 2007, at 12:03 PM, Michael G. Ströck wrote:


Am 09.02.2007 um 20:41 schrieb Murat Konar:

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

Thanks murat, but detecting the option key is, I believe, not the problem, the problem is getting the button to change it's appearance and action while your application does NOT have focus. Where do I do that?

Aha. The problem is that your app, when not active, will not receive key or any other events.


You could set up a timer (NSTimer) to periodically check the state of the option key (but that would be polling), or if you're not afraid of Carbon, see the "EventMonitorTest" sample code at

<http://developer.apple.com/referencelibrary/Carbon/ idxEventsOtherInput-date.html>

_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


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

  • Prev by Date: Re: Framework for printing reports?
  • Next by Date: LDAP Kerberos support...
  • Previous by thread: Re: iTunes-like behaviour of NSButton with NSAlternateKeyMask
  • Next by thread: Need list of apps that can open file type
  • Index(es):
    • Date
    • Thread