简体   繁体   English

NSWindow在主窗口后面

[英]NSWindow going behind main window

I have a main window for my application. 我有一个主窗口供我申请。 When a button is clicked I present another window (smaller one). 单击一个按钮时,我会显示另一个窗口(较小的一个)。 This is shown above the main window by default. 默认情况下,它显示在主窗口上方。 From the smaller window I have a option to navigate to a browser page. 从较小的窗口我可以选择导航到浏览器页面。 When I do this my both windows go to background and browser will be at the front. 当我这样做时,我的两个窗口都转到后台,浏览器将在前面。 After that when I try to click my smaller window, it's coming behind the main window. 之后当我尝试点击我的小窗口时,它就在主窗口后面。 I need it to come above main window. 我需要它来到主窗口之上。 Is there any way out? 有什么出路吗?

You can use addChildWindow:ordered: 您可以使用addChildWindow:ordered:

After the childWindow is added as a child of the window, it is maintained in relative position indicated by orderingMode for subsequent ordering operations involving either window. 在将childWindow添加为窗口的子窗口之后,它将保持在由orderingMode指示的相对位置,以用于涉及任一窗口的后续排序操作。 While this attachment is active, moving childWindow will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause childWindow to move. 当这个附件处于活动状态时,移动childWindow不会导致窗口移动(如滑入或滑出抽屉),但移动窗口将导致childWindow移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM