Timerde geri sayım yapmak istiyorum
Örnek 1 : SpinEdit deki 60000 sayısını caption da kalan süreyi 60 sayiye olarak geri sayım nasıl başlata bilirim?
Örnek 2 : SpinEdit deki 12000 sayısını caption da kalan süreyi 120 sayiye.

Kod: Tümünü seç
var
saniye,salise :Integer;
begin
dec(zaman); // Zaman değişkeni global bir değişkendir.
saniye := (zaman div 10);
salise := (zaman mod 10);
panel1.Caption := Inttostr(saniye)+'.'+Inttostr(salise);
end;
Kod: Tümünü seç
Delete from hayat where cins="çıkarcılar"
Kod: Tümünü seç
Timer.Interval := StrToInt(SpinEdit1.Text);
Kod: Tümünü seç
USES DateUtils;
Var
xGeriSay : Integer; // Saniye
xBasZaman, xZaman : TDateTime;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if NOT Timer1.Enabled then
begin
BitBtn1.Caption := 'DURDUR';
Timer1.Interval := 1000;
xBasZaman := Now;
xZaman := xBasZaman;
xGeriSay := SpinEdit1.Value;
Timer1.Enabled := True;
Caption := Format('%d/%d', [ xGeriSay - SecondsBetween(xBasZaman, xZaman), xGeriSay ]);
end else begin
Timer1.Enabled := False;
BitBtn1.Caption := 'BAŞLAT';
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
xZaman := IncSecond( xZaman, -1 );
if IncSecond( xBasZaman, -1*xGeriSay ) >= xZaman then BitBtn1Click(nil);
Caption := Format('%d/%d', [ xGeriSay - SecondsBetween(xBasZaman, xZaman), xGeriSay ]);
end;