Autor Beitrag
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: So 04.04.04 20:42 
Hi,

ich verwende in einem Programm eine repeat/until-Schleife, die verlassen wird sobald eine bestimmte Schaltfläche angeklickt wurde.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
repeat
// Nun kommen diverse Befehle, die ich mir hier spare
:
:
:
:
:
// hier sollte nun eine Pause eingefügrt werden
:
until abbrechen=true;


Nun möchte ich die Schleife eine bestimmte Zeit (z.B. 30 Sekunden) anhalten lassen. Trotzdem soll das Porgramm auf den Schaltflächen-Klick reagieren.

Wie kann ich das machen?

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
Pascal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 155

Win 98, Win XP
Delphi 2005, Delphi 5
BeitragVerfasst: So 04.04.04 20:56 
ausblenden Delphi-Quelltext
1:
2:
zeit:=gettickcount+30000;
while gettickcount<zeit do application.processmessages;
schitho Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: So 04.04.04 21:51 
Thanx!

Code funktioniert. Allerdings wir durch die Schleife die CPU ganz schön (unnötig) beschäftigt.

Gibt es noch eine andere Möglichkeit, ohne dass dabei der PC so beschäftigt wird?

Danke

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
Brainiac
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 05.04.04 09:23 
ausblenden Delphi-Quelltext
1:
while gettickcount<zeit do begin application.processmessages; Sleep(25); end;					
iGoA
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 103

Alle Win´s
D5 Prof
BeitragVerfasst: Mo 05.04.04 09:47 
Willst Du nich lieber einen Timer benutzen? Is vielleicht "sauberer".
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 05.04.04 12:41 
Ich hab letztens einen neuen Tipp für ein resourcenschonendes Delay zum FAQ hinzugefügt: www.delphi-forum.de/viewtopic.php?t=23225

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!