Search code examples
objective-ccocoamacosnstextfieldnswindowcontroller

Is it possible to bring window to front without taking focus?


I am working on an application for my personal usage that will remind me of stuff at regular intervals and/or will require text entry. Hence this popup window has an NSTextField.

If the window pop's up when I am in the middle of typing, my typing transfers to the popup window which is very annoying! Is there any way to stop this, currently I am using:

[NSApp activateIgnoringOtherApps:YES];
[hudWindow makeKeyAndOrderFront:nil];

I have also tried:

[NSApp activateIgnoringOtherApps:YES];
[hudWindow orderFrontRegardless];

Is there any other way to do it?


Solution

  • [hudWindow orderFront: nil];
    

    Moves the window to the front of its level in the screen list, without changing either the key window or the main window.