Difference between revisions of "longtimer"

From Free Pascal wiki
Jump to navigationJump to search
(Initial page)
 
(LongTimer information)
Line 6: Line 6:
  
 
[[File:longtimer_oi.png]]
 
[[File:longtimer_oi.png]]
 +
====Properties====
 +
*Enumerated types
 +
#IntervalType = (lt1Daily,lt2Weekly,lt3Monthly)
 +
#WeeklyDay = (lt1Monday,lt2Tuesday,lt3Wednesday,lt4Thursday,lt5Friday,lt6Saturday,lt7Sunday)
 +
#SampleInterval = (lt1Everyminute,lt2Every5minutes,lt3Every10Minutes,lt4Every30Minutes,lt5Every45Minutes)
 +
*Others
 +
#Daily24Hour - 0 = Midnight, 1 = 1am ... 14 = 2pm etc.
 +
#MonthlyDate - 1 = 1st, 2 = 2nd etc.
 +
====Methods====
 +
*The OnTimer event will only fire according to the above properties
 +
 +
*To fire the Ontimer every day at approx. 10am
 +
<syntaxhighlight>
 +
LongTimer1.IntervalType:=lt1Daily;
 +
LongTimer1.Daily24Hour:=10;
 +
LongTimer1.Enabled:=TRUE;
 +
</syntaxhighlight>
 +
 +
*To fire the Ontimer on the last day of every month at approx. 10am
 +
<syntaxhighlight>
 +
LongTimer1.IntervalType:=lt3Monthly;
 +
LongTimer1.MonthlyDate:=31;
 +
LongTimer1.Daily24Hour:=10;
 +
LongTimer1.Enabled:=TRUE;
 +
</syntaxhighlight>
 +
Note that if a month has less than 31 days, LongTimer will automatically compensate
 +
====Download====
 +
*Download the TlongTimer component from the Lazarus CCR Repository
 +
 +
[[Category:Components]]

Revision as of 23:52, 12 October 2014

LongTimer

Summary

  • The Tlongtimer component is a descendent of TIdleTimer component, and shares its properties and methods.
  • Additional properties affect when the OnTimer event is fired.
  • With LongTimer, the OnTimer event is fired only once - every time the interval you set is reached.

longtimer oi.png

Properties

  • Enumerated types
  1. IntervalType = (lt1Daily,lt2Weekly,lt3Monthly)
  2. WeeklyDay = (lt1Monday,lt2Tuesday,lt3Wednesday,lt4Thursday,lt5Friday,lt6Saturday,lt7Sunday)
  3. SampleInterval = (lt1Everyminute,lt2Every5minutes,lt3Every10Minutes,lt4Every30Minutes,lt5Every45Minutes)
  • Others
  1. Daily24Hour - 0 = Midnight, 1 = 1am ... 14 = 2pm etc.
  2. MonthlyDate - 1 = 1st, 2 = 2nd etc.

Methods

  • The OnTimer event will only fire according to the above properties
  • To fire the Ontimer every day at approx. 10am
LongTimer1.IntervalType:=lt1Daily;
LongTimer1.Daily24Hour:=10;
LongTimer1.Enabled:=TRUE;
  • To fire the Ontimer on the last day of every month at approx. 10am
LongTimer1.IntervalType:=lt3Monthly;
LongTimer1.MonthlyDate:=31;
LongTimer1.Daily24Hour:=10;
LongTimer1.Enabled:=TRUE;

Note that if a month has less than 31 days, LongTimer will automatically compensate

Download

  • Download the TlongTimer component from the Lazarus CCR Repository