如何确保对话框始终位于主窗口的前面

如何确保对话框始终位于主窗口的前面

本文介绍了如何确保对话框始终位于主窗口的前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有找到最好的解决方案。我有一个非模态对话框,可以通过应用程序中的热键在无限制的实例中打开。即使对话框本身也可以打开一个新的实例。我希望这些对话框总是在主应用程序窗口的前面。我已经尝试了几件事。




  • 将FormStyle设置为fsStayOntop。这是有效的,但是有一个优点是,即使是其他应用程序,对话框也将在所有窗口的前面。我只希望它在我的主窗口前面。

  • 将PopupMode设置为pmAuto。除了一个对话框打开另一个对话框的情况下,这也是有效的。如果第一个对话框关闭,那么它会自动关闭第二个对话框。这是不能接受的。

  • 使用表单的默认属性。一旦主窗口被点击,打开的对话框就在主窗口后面。



任何其他建议: - )

解决方案

从;


I have not yet found the best solution for this. I have a non modal dialog that can be opened in unlimited instances by a hotkey in the application. Even the dialog itself can open a new instance. I want those dialogs to always be front of the main application window. I have tried a couple of things.

  • Set FormStyle to fsStayOntop. This works but have the advantage that the dialog will be front of ALL windows even other applications. I only want it to be front of my main window.
  • Set PopupMode to pmAuto. This also works except for the case when one dialog open another dialog. If the first dialog is closed then it automatically close the second one. This is not acceptable.
  • Use the default properties for a form. As soon as the main window is clicked on the opened dialogs is behind the main window.

Any other suggestions :-)

解决方案

From TCustomForm.PopupParent Property;

.

这篇关于如何确保对话框始终位于主窗口的前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 06:25