• 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
Getting keydown events during a drag
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: [OT] Re: Is NSMethodSignature compiler-dependent?
  • Next by Date: Re: long Tigers
  • Previous by thread: NSDocument's canCloseDocumentWithDelegate:...
  • Next by thread: Re: Display Keys-Values in Spotlight
  • Index(es):
    • Date
    • Thread