Getting keydown events during a drag
Getting keydown events during a drag
- Subject: Getting keydown events during a drag
- From: Steve Gehrman <email@hidden>
- Date: Fri, 13 May 2005 04:08:51 -0700
I want to know if the space bar is pressed while I'm doing a drag and
drop in Cocoa.
The code below use to work in Panther, but it doesn't seem to work in
Tiger.
Any ideas?
// check for a space key down event
NSEvent *nextEvent = [NSApp
nextEventMatchingMask:NSKeyDownMask untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode dequeue:YES];
if (nextEvent)
{
if ([[nextEvent characters] isEqualToString:@" "])
{
// IT WORKED!!!
// remove the key up event
nextEvent = [NSApp
nextEventMatchingMask:NSKeyUpMask untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode dequeue:YES];
}
}
-steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden