[英]Pop dialog in front of an active open file dialog
When the user opens some files, I use the open event in order to make some operations before enabling him to actually open. 当用户打开一些文件时,我使用open事件来进行一些操作,然后才能使其真正打开。 For that I have a progress dialog.
为此,我有一个进度对话框。
However, my dialog is always opened behind the open file dialog. 但是,我的对话框总是在打开文件对话框的后面打开。
I've added the following code to windowDidLoad
of my NSWindowController
: 我在
NSWindowController
windowDidLoad
中添加了以下代码:
[NSApp activateIgnoringOtherApps:YES];
[[NSApplication sharedApplication] runModalForWindow:self.window];
But it didn't make any impact. 但这并没有产生任何影响。
How can I display my dialog in front? 如何在前面显示对话框? Note that my dialog is opened after it and closed before it.
请注意,我的对话框是在它之后打开并在它之前关闭。
在评论的帮助下,我发现在显示窗口之前添加以下行解决了该问题:
self.window.level = NSPopUpMenuWindowLevel;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.