Re: Finding keyboard state in Cocoa
Re: Finding keyboard state in Cocoa
- Subject: Re: Finding keyboard state in Cocoa
- From: Vince DeMarco <email@hidden>
- Date: Sat, 25 Aug 2001 22:46:04 -0700
On Saturday, August 25, 2001, at 10:03 pm, Tony wrote:
AFAIC currently you must use Carbon GetKey to find, for example,
Caps Lock key state. Cocoa keyDown would not be called if you press
Shift key.
As there are apps where this functionality is important, mine being
one of them, are there plans to add it to Cocoa or are there ways
to get it that I am unaware of?
NSResponder has a method called flagsChanged:.
see the docs.
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/
ObjC_classic/Classes/NSResponder.html
quoting form the docs
flagsChanged:
- (void)flagsChanged:(NSEvent *)theEvent
Informs the receiver that the user has pressed or released a modifier key
(Shift, Control, and so on). NSResponder's implementation simply passes
this message to the next responder.