Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

consoleart

macrumors newbie
Original poster
Sep 23, 2014
3
0
I have a clarification WRT to a NSWINDOWSCONTROLLER class, how do i add a keydown event to the windows controller class. i assume i need a NSVIEW subclass for the keydown events to fire, but my current class is subclassed from nswindowscontroller because its a multiple window application.
 
The docs say that NSWindowController inherits from NSResponder so theoretically it can respond to events.

I would read up on the NSResponder class as a reference. Read the Mac OS Cocoa Event Handling Guide to read about the design of Events in Cocoa apps. It will talk about the Responder Chain and how it works.
 
hi, yes, it responded, i was trying keying in some text inside a NSTEXTview and the event was not firing, and managed to wire the events now by inheriting the textview and calling a method from there to the parent class.

Thanks for the comments.
 
Another option would be to make your responder the "First Responder". Then you could decide which keys to handle and which ones to not handle. You wouldn't have to mess with the text field at all.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.