Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle keyboard events in subclass of NSViewController?

I am creating one cocoa application having wizard like structure.

All dialogs are subclass of NSViewController. Currently I am not able get keyboard events such as keyDown and keyUp..

Please help me to solve this problem....

Thanks in advance....

like image 447
Priya Avatar asked Oct 24 '25 03:10

Priya


1 Answers

Override keyDown: and keyUp: method.

-(void)keyUp:(NSEvent*)event
-(void)keyDown:(NSEvent*)event

and

- (BOOL)acceptsFirstResponder {
    return YES;
}

In subclass of NSViewController you should refer Cocoa Event-Handling Guide .

like image 111
Parag Bafna Avatar answered Oct 26 '25 22:10

Parag Bafna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!