AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Before and after events

Ein Thema von sdean · begonnen am 5. Dez 2009 · letzter Beitrag vom 5. Dez 2009
Antwort Antwort
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

Before and after events

  Alt 5. Dez 2009, 09:41
i'm trying to implement a Before and After Event onTime :

how could i do an event before Min Value 'in this case 5 minutes ' ?
Delphi-Quellcode:
Procedure Before(Min:Word);
Var
Tm:TTime;
begin
Min:=5;// 5 Miutes
Tm:=Now;
{
for example :
if before 5 Minutes then
ShowMessage('5 minutes to go ');
}

end;
how could i do an event after Min Value 'in this case 5 minutes ' ?

Delphi-Quellcode:
Procedure After(Min:Word);
Var
Tm:TTime;
begin
Min:=5;// 5 Miutes
Tm:=Now;

{
for example :
if after 5 Minutes then
ShowMessage('5 minutes passed');
}

end;
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.149 Beiträge
 
Delphi 12 Athens
 
#2

Re: Before and after events

  Alt 5. Dez 2009, 10:50
Zitat:
i'm trying to implement a Before and After Event onTime :
Depending on what?

Code:
if before 5 Minutes then
if Tm - (Min / 24 / 60) = ... then When using a TTimer or equivalent never check for equality!
e.g.
if Abs(Tm - (Min / 24 / 60) - ...) < {interval} then
Delphi-Referenz durchsuchenMin is not a good variable name, especially if it integrates the unit Math.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#3

Re: Before and after events

  Alt 5. Dez 2009, 10:58
Thank you himitsu

All depends on the Current Time :

i use TTimer .

if X minutes to the current time then Before

if X minutes passed from current time then after

i hope i gave a little detail
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#4

Re: Before and after events

  Alt 5. Dez 2009, 16:37
I reformed my Question as follows :

how could i do an event before Min Value 'in this case 5 minutes ' ?


Delphi-Quellcode:
Procedure Before(Min:Word);
Var
 Sm, // System Time ; Time to compare To
 Mt: // My Time ; Time to compare with

S:String;
TTime;
begin
S:='10:05:00';
Min:=5; // 5 Miutes
Sm:=Now; // system time
Mt:=StrToTime(S);// My Time
{
Let's suppose the fowlling :
Sm:=10:00:00;  // System Time
Mt:=10:05:00; //  My Time
That means it's 5 minutes to rich Mt time '10:05:00'

if before 5 Minutes then
ShowMessage('5 minutes to rich My Time ');
}
 
end;

how could i do an event after Min Value 'in this case 5 minutes ' ?

Delphi-Quellcode:
Procedure After(Min:Word);
Var
 Sm, // System Time ; Time to compare To
 Mt: // My Time ; Time to compare with

S:String;
TTime;
begin
S:='10:00:00';
Min:=5; // 5 Miutes
Sm:=Now; // system time
Mt:=StrToTime(S);// My Time
{
Let's suppose the fowlling :
Sm:=10:05:00;  // System Time
Mt:=10:00:00; //  My Time
That means it's 5 minutes passed from Sm time '10:05:00'

if after 5 Minutes then
ShowMessage('5 minutes passed from system time ');
}

end;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz