如何在不移动子 NSWindows 的情况下移动 NSWindow
我有一个主窗口,它是我的应用程序的中心。对于不同的功能,我打开一个子窗口来处理某些专门的功能。我希望所有窗口都能独立移动,但现在如果我移动原始的中央窗口,那么所有这些子窗口都会随之移动。如何使子窗口断开连接,以便它们不随父窗口一起移动?
I have a main window that is the center of my application. For different functions I open a child window to handle certain specialized functions. I want all of the windows to move independently, but right now if I move the original, central window then all of those child windows move with it. How can I make the child windows disconnected so they don't move with the parent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在移动窗口之前暂时删除子项,然后将它们放回去:
或者,如果您不需要 NSWindowAbove 排序,则首先不要将它们设为子项:)
Remove children temporarily before the window is moved, then put them back:
Or, if you don't need NSWindowAbove ordering, just don't make them child in the first place :)
另一种方法是,您可以显示子窗口,而不将其添加为子窗口,但在窗口级别内实现相同的行为:
我不确定这种方法是否正确且良好的解决方案,但它对我有用。
Another way you can show your child window without adding it as a child window, but achieve the same behavior within window' level:
I'm not sure is this method is correct and good solution, but it works for me.