Handling keyDown events
Handling keyDown events
- Subject: Handling keyDown events
- From: Paolo Bertani <email@hidden>
- Date: Fri, 5 May 2006 21:51:06 +0200
Hi,
my app has one window which is main and key.
There is one table, some text field and so on.
Now I need to intercept some keys in order to take some action: arrow-
down, cmd-space, etc...
In IB I subclassed NSWindow, creating MyWindow class. Then generated
files fo MyWindow.
Selected the main window's NSWindow instance and, within the
inspector, changed the custom class from NSWindow to MyWindow.
I opened the file MyWindow.c and overrided keyDown method this way:
#import "MyWindow.h"
@implementation MyWindow
-(void)keyDown:(NSEvent *)theEvent
{
NSLog( @"keydown!" );
[super keyDown:theEvent];
}
@end
I also edited MyWindow.h this way
/* MyWindow */
#import <Cocoa/Cocoa.h>
@interface MyWindow : NSWindow
{
}
-(void)keyDown:(NSEvent *)theEvent;
@end
Unfortunately the overrided keyDown is not called when I type on the
keyboard.
What I am missing?
Thank you in advance...
"<Ai sensi e per gli effetti del D.Lgs. n.° 196/2003 (Codice della Privacy) si precisa che questo messaggio, ed eventuali relativi allegati, è strettamente riservato ai destinatari in indirizzo, con espressa diffida di conservazione, uso, copiatura o divulgazione.
Chiunque lo riceva, non essendone destinatario, è pregato di avvertire lo scrivente e di provvedere alla distruzione di quanto erroneamente pervenuto>"
_______________________________________________
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