I switch from displaying one NSView to another. But to be able to receive keystrokes typed in from the user, the user must first click the mouse on the NSView. I want the user to be able to type-in without having to click on the NSView...
There is a good guide from Apple on Event Handling Basics. See the "Preparing a Custom View for Receiving Events" and "Setting the First Responder" sections.
TL;DR: You have to override acceptsFirstResponder
on your custom NSView
to return true and then call makeFirstResponder
on the NSWindow
with your view as argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With