4

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

0

3 Answers 3

4

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 .

Sign up to request clarification or add additional context in comments.

Comments

1

If you are trying to simply get an event for escape, use this instead:

override var acceptsFirstResponder: Bool { return true } override func cancelOperation(_ sender: Any?) { // The user pressed escape } 

Comments

0

Setting window to "Auto Recalculates View Loop" in Inteface Builder has worked for me.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.