Registriert seit: 25. Apr 2008
Ort: Neunkirchen
741 Beiträge
|
AW: Timer während Laufzeit erstellen..
22. Mai 2017, 22:08
Delphi-Quellcode:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
procedure TimerEvent(Sender: TObject);
public
{ public declarations }
end;
var
Form1: TForm1;
MyTimer: TTimer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.TimerEvent(Sender:TObject);
begin
Caption := ' erfolgreich';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyTimer := TTimer.Create(self);
MyTimer.Interval := 100;
MyTimer.OnTimer := @TimerEvent;
MyTimer.Enabled := True;
end;
end.
|
|
Zitat
|