Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 390
Jay Avatar asked Feb 05 '11 03:02

Jay


2 Answers

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

like image 174
cocoafan Avatar answered Oct 28 '22 10:10

cocoafan


Did you try using setLevel:? Setting it to one of the higher levels should do the trick.

like

[hudWindow setLevel:NSFloatingWindowLevel];

like image 22
Ken Aspeslagh Avatar answered Oct 28 '22 10:10

Ken Aspeslagh