【发布时间】:2010-08-06 08:38:16
【问题描述】:
我希望从我的应用程序中打开一个对话框,在某些情况下应该立即关闭(在收到一条短消息后)。
我试过了:
procedure TForm2.FormActivate(Sender: TObject);
begin
if SomeCondition then
begin
ShowMessage('You can''t use this dialog right now.');
close;
modalresult := mrCancel;
end;
end;
但对话框仍然打开。我也试过把代码放在 OnShow 事件中,但结果是一样的。
为什么这不起作用?
【问题讨论】: