Autor Beitrag
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 08.10.05 20:30 
Also ich habe das Problem, das ich einen Timer brauche, der 3Sachen macht. Funktion 1, 2 und 3

Es soll so sein, das wenn man auf einen Knopf drückt Funktion 1 gestartet werden soll, dann 5 Sekunden später Funktion 2 und dann noch mal 5Sek später Funktion3. Mit sleep geht es, aber finde das nicht so gut da das Programm dann ja nicht mehr reagiert in der Zeit :(

greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 08.10.05 20:58 
nimm nen zähler, erhöhe den jedesmal und mach dann abhängig von dessen wert, was getan werden muss.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Born-to-Frag Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 08.10.05 21:05 
erm.. ja.. Könntest du das vielleicht ein bisschen genauer erklären :oops:?

Danke

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
loid
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 57

win xp,sp2
d7 pers,free pascal
BeitragVerfasst: Sa 08.10.05 21:07 
also ich würde da an eine for-schleife denken.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 08.10.05 22:00 
user profile iconBorn-to-Frag hat folgendes geschrieben:
erm.. ja.. Könntest du das vielleicht ein bisschen genauer erklären :oops:?

Danke

muss man euch immer alles auf dem silbertablett servieren ? :roll:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var counter : integer = 0;
...
proc ontimer
begin
  inc(counter );
  case counter of 1: func1;
                  2: func2;
                  3: func3;
  end;
end;

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Moonbiker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Mo 10.10.05 19:32 
ich verwende bei sowas immer folgende wait procedure, und bin damit bis jetzt immer gut gefahren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
[...]
    procedure Wait(time: double);
[...]
procedure TMainForm.Wait(time: double);
var Start: Integer;
begin
Start:=GetTickCount;
while GetTickCount-Start <= time do application.ProcessMessages;
end;
[...]
wait(200); //wären jetzt 200ms warten
[...]


hat die Vorteile, dass man auch innerhalb der procedure bspweise tasten abfragen kann, bspweise ein '#13' oder ähnliches...
(und nat., dass die anwendung weiter arbeitet (application.ProcessMessages;)...)

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Mo 10.10.05 20:05 
user profile iconMoonbiker hat folgendes geschrieben:
hat die Vorteile, dass man auch innerhalb der procedure bspweise tasten abfragen kann, bspweise ein '#13' oder ähnliches...

und hat den nachteil dass in den 15 sekunden die cpulast auf 100% ist.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...