防止重新进入的一种方法是记住你是否输入了事件处理程序:
type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure ApplicationEvents1Idle(Sender: TObject; var Done: Boolean);
private
{ Private-Deklarationen }
FInOnIdle: Boolean;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean);
begin
if FInOnIdle then Exit;
FInOnIdle := True;
try
finally
FInOnIdle := False;
end;
end;Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
458 次 |
| 最近记录: |