hier hab ich mal einen count down geschrieben
aber der ist nicht ganz so elegant wie der vorschlag von tmc2004
oder so hoch "entwickelt" oder so
ders recht primitiv aber, der funktioniert einwandtfrei und ist sehr leicht nach zu vollziehen
aber eben sehr sehr einfach.....
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
| procedure TForm1.Button1Click(Sender: TObject); begin Timer1.Enabled := True; Label2.Caption := Edit1.Text; Label3.Caption := Edit2.Text; Label4.Caption := Edit3.Text; Label5.Caption := Edit4.Text; end;
procedure TForm1.Timer1Timer(Sender: TObject); var Minute, Second, Hour, day : integer; begin
Label1.Caption := Label2.Caption + ':' + Label3.Caption + ':' + Label4.Caption + ':' + Label5.Caption; Second := StrToInt(Label5.Caption)- 1; Minute := StrToInt(Label4.Caption); Hour := StrToInt(Label3.Caption); day := StrToInt(Label2.Caption);
begin if Second >= 0 then begin Label5.Caption := IntToStr(Second); end; if Label5.Caption = '0' then begin Label5.Caption := IntToStr(59); Label4.Caption := IntToStr(Minute - 1); end; end; if Label4.Caption = '0' then begin Label3.Caption := IntToStr(Hour - 1); Label4.Caption := IntToStr(59); end;
if Label3.Caption = '0' then begin Label2.Caption := IntToStr(day - 1 ); Label3.Caption := IntToStr(23);
end; end; |
in die edit felder kann man dann praktisch die startzeit eingeben: also tage, stunden, minuten und sekunden bis zum punkt sero.......
naja wollt einfach mal versuchen einen alternativen, gut nachvollziehbaren vorschlag zu machen
bis dann
///EDIT: ist mir grad aufgefallen der code funktioniert noch nicht so 100%, sorry das habsch zu spät gemerkt, hmm mist
aber naja warn versuch........