Autor Beitrag
neo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179



BeitragVerfasst: Mi 16.04.03 22:23 
Hallo!

Ich möchte, dass ich die Zeit, bis der Timer die Aktion ausführt, angezeigt bekomme.

Sozusagen einen Countdown.

Weiß wer wie das geht?

Danke!!!
DiggiDi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Mi 16.04.03 22:50 
ich weiss nicht genau schreib aber trotzdem: www.delphi-treff.de/...urs/index.php4?kat=3 wenn du dir das anscheust wird dir villeicht was einfallen :)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 16.04.03 23:43 
Könntest Du nicht einfach den Timer auf ein viel kürzeres Intervall einstellen und wenn er das x-te Mal durchgelaufen ist, die Aktion ausführen. Bei den Durchläufen davor kannst Du dann die Zeit anzeigen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
MKehrer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

NT, 2000
D6
BeitragVerfasst: Do 17.04.03 09:33 
Hi Neo,

kombiniere halt 2 Timer

Timer1.Interval<Timer2.Interval

In Timer1 erledigst Du den Countdown
wenn der Countdown auf 0 ist -> Timer2.OnTimer;

_________________
Manfred
Was Du siehst ist in Dir (Smile)
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Fr 18.04.03 20:52 
Wenn du den Timer bzw. sein Intervall auf 1000 festlegst, heißt das ja, eine Sekunde.

Als Variable definierst du z.b.:

I: Integer;

In der FormCreate setzt du I=0!
Nun machst du in der Prozedur OnTimer folgendes:

ausblenden Quelltext
1:
I:=I+1;					


Das heißt, jede Sekunde wird I um eins erhöht und wenn I eine bestimmte Zahl erreicht hat, z.B. eine Minute (60 Sekunden :-) ) -> I ist dann entsprechend auch 60, dann kannst du folgendes machen:

ausblenden Quelltext
1:
If I=60 Then ...;					


Dann macht der Timer nur etwas, wenn I auch wirklich die Zahl hat, die es haben soll. Oder du machst es, wie MKehrer schon gesagt hat.

Grüße, Alex..

_________________
Hasta La Victoria Siempre
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 18.04.03 20:59 
Das war doch genau das, was ich beschrieben habe!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 01:04 
Hi,

wenn du Intervall = 0 machst müßte I aber 1000 sein damit 1 sekunde um ist ;)

Aber da der Timer je nach OS einen anderen Minimal Intervall hat, würde ich den Intervall auf minimal 100ms setzen.

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
neo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179



BeitragVerfasst: Sa 19.04.03 13:55 
Titel: RE:
Danke für die vielen Antworten!

Ich habs jetzt so gelöst:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
   Countdown:TTime;

procedure TForm1.TimCountdownTimer(Sender: TObject);
begin
        Countdown:=Countdown-strtotime('00:00:01');
        lblCountdownZeit.Caption:=TimeToStr(Countdown);

        if Countdown<strtotime('00:00:00') then
        begin        
        TimCountdown.Enabled:=false; 
        showmessage('Countdown abgelaufen');
        end;
        
end;


TimerIntervall ist natürlich auf 1000 ms gesetzt.
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Sa 19.04.03 19:46 
@PeterLustig:

Schon gut, nicht gleich böse werden. Wollte ihm ja nur eine Hilfe geben, jeder hat mal klein angefangen, oder?

:beer:

Grüße, Alex..

_________________
Hasta La Victoria Siempre
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 19.04.03 20:16 
Zitat:
Schon gut, nicht gleich böse werden.
Ich bin das Böse! Aber es glaubt mir keiner ...

Zitat:
Wollte ihm ja nur eine Hilfe geben, jeder hat mal klein angefangen, oder?
Hast schon recht, aber dann hätte er ja nachfragen können. Und dass ich Anfängern unzulänglich helfe, dafür bin ich eigentlich nicht bekannt ... hoffe ich zumindest.


:beer:

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Terra23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Mo 21.04.03 14:07 
Stimmt, ich hab dich im Fernsehen gesehen. Du bist das leibhaftige böse..


:twisted:

CU

_________________
Hasta La Victoria Siempre