Autor Beitrag
Avalon
Hält's aus hier
Beiträge: 8

Win 98, Win ME, Win XP
D7 Pers
BeitragVerfasst: Do 08.04.04 12:53 
Ich will in ein Programm einen counter integrieren, der ab Programmstart anfäng, sekunden zu zählen, und bei eineb bestimmten ereigniss aufhört. Kann mir da jemand helfen? Bitte bitte!
Thx im vorraus Av@lon

_________________
All computers wait the same speed ;-)
NetZwerg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 448

Slackware 10.1
Kylix 3, D5 Standard
BeitragVerfasst: Do 08.04.04 12:59 
Du nimmst nen Timer, stellt Intervall auf 1000.
dann OnTimer:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Timer1Timer(Sender: TObject);
var
  Seconds, Minutes, Hours: Integer;
begin
  Seconds := Seconds + 1;
  If Seconds = 60 then
  begin
    Seconds := 0;
    Minutes := Minutes + 1;
  end;
  If Minutes = 60 then
  begin
    Minutes := 0;
    Hours := Hours + 1;
  end;
end;


Wen du was am Code nich verstehst, nur nachfragen!! :D

cya, dave

_________________
"Manche Leute drücken nur deshalb ein Auge zu, damit sie besser zielen können."
Billy Wilder, amer. Filmregisseur
Avalon Threadstarter
Hält's aus hier
Beiträge: 8

Win 98, Win ME, Win XP
D7 Pers
BeitragVerfasst: Do 08.04.04 13:03 
ich werd mal versuchen, obs klappt. Danke auf jeden fall !!!

_________________
All computers wait the same speed ;-)
iGoA
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 103

Alle Win´s
D5 Prof
BeitragVerfasst: Do 08.04.04 14:42 
Ich glaube Minutes, Seconds und Hours müssen globale Variablen sein, da sie sonst bei jedem Aufruf der Methode reinitialisiert werden. War jedenfalls früher bei Turbo Pascal so. *g*
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Do 08.04.04 16:41 
das seconds := seconds +1
kannst du ganz einfach durch
inc(seconds)machn
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Do 08.04.04 20:42 
Technisch gesehen macht's aber keinen Unterschied (gleicher assembler-Code seit einigen Versionen (5 oder 6?).
Und wenn man den Befehl inc() nicht kennt, ist "var := var + 1" ein wenig einfacher zu verstehen ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert