【问题标题】:Is Delphi's InputBox modal? ie should it wait for input?Delphi 的 InputBox 是模态的吗?即它应该等待输入吗?
【发布时间】:2020-05-11 09:28:21
【问题描述】:

这是 Windows 10 中的错误还是只是卡住的键?

在我的 Delphi 2009 应用程序中,我通过一个放置在 while 循环内的简单输入框来询问用户的姓名,这样他们就不能将其留空。如果他们取消或单击“确定”而不输入名称,则会显示验证消息,然后循环循环并再次询问。

我的一个用户(使用 Windows 10,但我不知道是哪个版本)到了这一点,应用程序在这个循环中挂起。他们将屏幕描述为“闪烁”,屏幕截图显示了屏幕上的输入框和验证消息,但几乎是透明的,表明它们都显示得非常快。我的应用程序保留的日志也显示它到达了循环之前的点,但没有进一步。这个用户可以在不同的日子重现。

以防万一,我检查了这些 SO 帖子 herehere 但我的这段代码太简单了,我看不出会发生什么。

有问题的代码是

function TFrmProcessIPaddressRemoteAccess_JHM.CheckAndProcessUserIPaddress( TheIPaddress: string): boolean;
const
    EMPTY_STRING = '';
var 
 comment : string;

begin

<stuff to do with checking if IP address is already on server>

comment := EMPTY_STRING;
 while comment = EMPTY_STRING do
       begin
       comment := inputbox('Adding IP address', 
                           'Your IP address is not in the list of those allowed access. ' + slinebreak
                          +'MAMbase is about to add it.' + slinebreak + slinebreak
                          +'Please enter your name so that the IP address can be identified', EMPTY_STRING);
       if comment = EMPTY_STRING then
            showmessage('Please enter your name');
       end;

<stuff to do with adding the IP address and the comment to the server>

end;

【问题讨论】:

    标签: delphi-2009 inputbox windows-10-desktop


    【解决方案1】:

    德尔福的InputBox是模态的吗?

    是的。

    【讨论】:

    • 不管是什么导致了你的问题,并不是缺少InputBox的模态。
    • 我一直这么认为。有点遗憾,因为这意味着我现在必须进一步调查这个相当奇怪的案例。谢谢。
    猜你喜欢
    • 2019-02-24
    • 2014-04-20
    • 1970-01-01
    • 2017-09-04
    • 1970-01-01
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多