Delphi - 如何防止Forms / MsgBoxes在以前的格式下移动? [英] Delphi - How to prevent Forms/MsgBoxes to move under prior form?

查看:193
本文介绍了Delphi - 如何防止Forms / MsgBoxes在以前的格式下移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多次Windows 98时代以后,我们经历过一些对话框失去了Z-Order,并返回到先前的格式。



例如:

  Dialog1.ShowModal; 

Dialog1.OnClickButton():ShowMessage('anything');

当MessageBox出现时,它有时没有焦点,并在Dialog1下移动。
用户对此感到困惑,他们说:我的应用程序冻结!
但是如果他们使用Alt + Tab移动到另一个应用程序并返回,焦点返回到MessageBox,它将是前台窗口。



我们有经历了ShowMessage,MessageBox,正常表单和QuickReport表单。



有人知道吗?这是Windows错误吗?你怎么能阻止它?如何抓住这个?感谢您的帮助:
dd






我真的说在WIN98之后,所以所有的操作系​​统(Win7也)都受这个问题的影响。
我们使用Delphi 6 Prof,所以这些属性不能使用默认格式。



有人说消息对话框可以通过MessageBox + MB_APPLMODAL来控制。
这是一个好消息,但是我们有许多旧的表单和组件,第三方工具。



所以使用替换来完成一个全新的应用程序是很难的的表格。



但是我们会尝试这样做。



我认为答案是这是一半应用程序问题和一半的Windows问题。如果Windows有时处理这个,有时候不会这样 - 似乎是一个Windows错误。
但是如果我们可以强制好的模态窗口,那么它是一个编程错误。



有人可以向我解释WS_POPUP标志的含义是什么?
它是否有一些副作用?



感谢:
dd

解决方案

这是 PopupMode PopupParent 属性用于。



例如do:

  Dialog1.PopupMode:= pmExplicit; 
Dialog1.PopupParent:= self;
Dialog1.ShowModal;

这告诉Windows正确的Z顺序。


Many times after the Windows 98 era we have experienced that some dialogs lose their Z-Order and move back to the prior form.

For example:

Dialog1.ShowModal;

Dialog1.OnClickButton() : ShowMessage('anything');

When MessageBox appears, it sometimes doesn't have focus and is moved under Dialog1. The users are confused about it, they say: My application froze!!! But if they use Alt+Tab to move to another app and back, the focus returns to the MessageBox and it will be the foreground window.

We have experienced this with ShowMessage, MessageBox, normal forms, and also QuickReport forms.

Does anyone know about this? Is it a Windows bug? How can you prevent it? How to catch this?

Thanks for your help: dd


I really said that AFTER Win98, so all OSs (Win7 also) are affected by this problem. We used Delphi 6 Prof, so the properties are not working with Default forms.

Somebody said that message dialogs are controllable with MessageBox + MB_APPLMODAL. This is good news, but we have many old forms and components, third party tools.

So it is hard work to make a completely new application with substitution of the forms.

But we will try doing this.

I think the answer is this is a half application problem and half a Windows problem. If Windows sometimes handles this, and sometimes doesn't - that seems to be a Windows bug. But if we can force good modal window making then it is a programming bug.

Can somebody explain to me what is the meaning of the WS_POPUP flag? Does it have some side effect or not?

Thanks: dd

解决方案

That's what the PopupMode and PopupParent properties are for.

E.g., you can do:

Dialog1.PopupMode := pmExplicit;
Dialog1.PopupParent := self;
Dialog1.ShowModal;

This tells Windows the correct Z-order.

这篇关于Delphi - 如何防止Forms / MsgBoxes在以前的格式下移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆