Re: Checking if a modifier key is pressed
Re: Checking if a modifier key is pressed
- Subject: Re: Checking if a modifier key is pressed
- From: Stéphane Sudre <email@hidden>
- Date: Mon, 4 Aug 2003 14:32:22 +0200
On lundi, ao{ 4, 2003, at 14:28 Europe/Paris, Jesus De Meyer wrote:
Hi,
I would like to check if a modifier key is pressed before I continue
with a certain method. Normally this would be done inside the keyDown
method, but I'm not using that.
Thanks in advance
_______________________________________________
#include <Carbon/Carbon.h>
// Various Key Codes
#define KeyShift 0x38
#define KeyControl 0x3b
#define KeyOption 0x3A
#define KeyCommand 0x37
#define KeyCapsLock 0x39
#define KeySpace 0x31
#define KeyTabs 0x30
int IsKeyPressed(unsigned short);
int IsKeyPressed(unsigned short key)
{
unsigned char km[16];
GetKeys((unsigned long *)km);
return ((km[key>>3] >> (key & 7)) & 1) ? 1 : 0;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.