• 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
a key down event problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a key down event problem


  • Subject: a key down event problem
  • From: Fei Li <email@hidden>
  • Date: Tue, 27 May 2003 09:53:57 -0600

Hello all,
I have a strange problem with key down event.

I have a full screen window which need to receive esc key event to
terminate the application. I use:
- (BOOL)canBecomeKeyWindow
{
return YES;
}

- (BOOL)canBecomeMainWindow
{
return YES;
}

-(void)keyDown:(NSEvent *)theEvent
{
unsigned short theKey;
theKey = [theEvent keyCode];

if (theKey == 53) //ESC key
{
[NSApp terminate:self];
}
}

in my window class. This works fine on MacOSX 10.1, but doesn't work on
MacOSX 10.2. The more strange thing is, on MacOSX 10.2, this also works
fine when I select Build & Run or Run Executable in ProjectBuilder, but
if I run it from finder window, my keyDown function will not be fired
(as I put a NSLog message in keyDown and it doesn't appear in console).

I'm really confused. If anyone have any idea about it?

Thanks for any information!

Fei
_______________________________________________
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.

  • Follow-Ups:
    • Re: a key down event problem
      • From: Christopher Corbell <email@hidden>
  • Prev by Date: Re: Rootless, complex NSOutlineView?
  • Next by Date: Re: Rootless, complex NSOutlineView?
  • Previous by thread: Re: Rootless, complex NSOutlineView?
  • Next by thread: Re: a key down event problem
  • Index(es):
    • Date
    • Thread