Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.033 Beiträge
Delphi 12 Athens
|
Re: procedure warten lassen
30. Aug 2004, 20:07
entweder:
Delphi-Quellcode:
Var Abbruch: Boolean;
Procedure Delay(msecs: Integer);
Var FirstTickCount: LongInt;
Begin
FirstTickCount := GetTickCount;
Repeat
Application.ProcessMessages;
Until ((GetTickCount - FirstTickCount) >= LongInt(msecs));
End;
Procedure TForm1.Button1Click(Sender: TObject);
Begin
Abbruch := True;
End;
Procedure TForm1.Button2Click(Sender: TObject);
Var i: Integer;
Begin
Abbruch := False;
For i := 1 to 1000 do Begin
Label1.Caption := IntToStr(i);
Delay(100);
If Abbruch Then Break;
End;
End;
oder
Delphi-Quellcode:
Var Abbruch: Boolean;
Procedure TForm1.Button1Click(Sender: TObject);
Begin
Abbruch := True;
End;
Procedure TForm1.Button2Click(Sender: TObject);
Var i: Integer;
Begin
Abbruch := False;
For i := 1 to 1000 do Begin
Label1.Caption := IntToStr(i);
Application.ProcessMessages;
Sleep(100);
If Abbruch Then Break;
End;
End;
oder ...
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
|