开发者

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

开发者 https://www.devze.com 2023-02-08 11:28 出处:网络
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.

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 wa开发者_如何转开发y to do it?


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


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

like

[hudWindow setLevel:NSFloatingWindowLevel];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号