Registriert seit: 23. Jun 2003
416 Beiträge
Delphi 2006 Professional
|
23. Jun 2003, 12:37
@Minz:
Delphi-Quellcode:
type
TForm1 = class(TForm)
Timer1: TTimer;
Memo1: TMemo;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FTimeOffsets: array[0..1000] of Byte;
FTimeElapsed: array[0..1000] of Byte;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
var
i: Integer;
begin
for i := Low(FTimeOffsets) to High(FTimeOffsets) do
begin
if FTimeElapsed[i] = FTimeOffsets[i] then
begin
FTimeElapsed[i] := 0;
// irgend etwas machen:
Memo1.Lines.Add('Virtueller Timer ' + IntToStr(i));
end
else
Inc(FTimeElapsed[i]);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
Randomize;
for i := Low(FTimeOffsets) to High(FTimeOffsets) do
FTimeOffsets[i] := Random(256);
end;
Bei diesem Code brauchst du nur eine Timer-Komponente und kannst beliebig viele "virtuelle" Timer erzeugen, die in verschiedenen Abständen auslösen.
"Electricity is actually made up of extremely tiny particles called electrons, that you cannot see with the naked eye unless you have been drinking." (Dave Barry)
|