I am creating NSWindow from a package loaded at runtime, so I do not have the source code for NSWindow that is created when the application starts. When I show my window, it receives a mouse event, but it does not receive any keyboard events. I tried to add a window with the following methods:
[_myWindow makeKeyAndOrderFront:nil]; [[NSApplication sharedApplication].mainWindow addChildWindow:_myWindow ordered:NSWindowAbove]; [NSApp beginModalSessionForWindow:_myWindow];
In all three cases, the main window appears, where there are all keyboard events. Mouse events also leak into the original window (I can see how the mouse above the backlight and the buttons respond to clicks through my window). I also tried:
[_myWindow makeMainWindow]; [_myWindow orderWindow:NSWindowAbove relativeTo:[originalWindow windowNumber]];
Any tips on getting keyboard events for my window are welcome.
source share