Contents Screen
TAdrockAlarmList

Click here for Properties 	Click here for Methods	Click here for Events

Unit

AdAlarm

Registration

Registration of this control will be available on-line via the CompuServe SWREG forum for $10.00 US. Go SWREG #XXXX

Please contact us at  CompuServe 100353,110 or Internet: DHMCC@IBM.NET.

Please set your subject line to TAdrockAlarmList for all correspondence regarding this component.

Include your name, EMAIL or physical address and Visa Number and Expiry Date if ordering directly.

Description

Use a TAdrockAlarmList component when you want to have alarms triggered in your programs.

To use this control just drop on your form. You then need to call the Add method to add an alarm,

There is no limit on the number of alarms the control can have.

With TAdrockAlarmList you set multiple alarms to go off (i.e., fire events) at various times during the day.  This control makes it easy to schedule events to happen at various times.  Just set the properties and wait for Alarm to notify you.

Alarm even tells you when the date has changed.  You can use this to remove all of the current alarms and set new ones for the day.  A must if youre writing a PIM.

The alarm time is very flexible because of the use of wildcards in the time format.

E.g. 10:??:05	This will trigger the alarm every minute from 10:00:00 to 10:59:59 but only when at 5 seconds past any minute in the hour.

E.g. 10:??:?5	This will trigger the alarm every minute from 10:00:00 to 10:59:59 but only when the seconds contain a 5 in the seconds: 05, 15, 25, 35, 45, and 55 seconds.

Any part of the time format can contain wildcards, including every part of the time format.

E.g. ??:??:??	This will trigger the alarm every second, no matter what the hour or minute.

The format is fixed and each segment (Hours, Minutes and Seconds) must be 2 digits long, either numbers or wildcards.

E.g. 10:05	This is invalid since the seconds must be specified, a EAlarmBadFormat exception will be raised in this situation.


Properties

This is the properties page for TAdrockAlarmList, please select a property.

Enabled

Name

Tag


Methods

Add

Delete

DeleteByRef


Events

OnAlarm

OnNewDate


OnAlarm

Applies to TAdrockAlarmList

Declaration

Event  Alarm(Sender: TObject;  AlarmEvent: Integer; Reference: String);

Description

This event gets fired for every alarm that gets triggered. The AlarmEvent is the actual position of the alarm in the list of alarms. The reference is the reference you used when you added the alarm. You can use the reference to identify which of the alarms has been triggered.


OnNewDate

Applies to TAdrockAlarmList

Declaration

Event NewDate(Sender: TObject;  NewDate: TDateTime);

Description

This event gets fired when the date changes at midnight, you can use this to re-program the list of timer events for the new day. Or whatever you want to do with it.


Enabled

Applies to TAdrockAlarmList

Declaration

property Enabled : Boolean;

Description

Set this property to enable or disable the alarms. Normally you would just leave this set to TRUE.


Add

Applies to

TAdrockAlarmList components

Declaration

method Add(AlarmTime, Ref : String);

Description

Calling this method will add an alarm to the AdrockAlarmList component. The alarmTime that you set can contain wildcards to allow any time to work with the alarm.

The Ref gets returned when the alarm is triggered, you can use this to know which alarm was triggered, it is a string property so can contain text or numbers.

If you supply an invalid AlarmTime format a EAlarmBadFormat exception will be raised.

Example

??:??:?2	Set the alarm to trigger for every time the seconds contains a 2,	E.g.  02, 12, 22, 32, 42, and 52 past the minute.
??:10:00	Set the alarm to trigger 10 minutes past any hour.	E.g.  1:10:00, 2:10:00, 3:10:00, 4:10:00, 5:10:00 etc.….
10:00:00	Set the alarm to trigger at 10 Oclock only.
??:??:??	Set the alarm to trigger every second.

As you can see the alarm is very flexible in its triggering

AdrockAlarmList1.Add(??:??:?2,Any Hour, Any Minute, and only X2 Seconds);

AdrockAlarmList1.Add(??:??:?5,Any Hour, Any Minute, and only  X5 Seconds);

AdrockAlarmList1.Add(??:?5:00,Any Hour, but only x5 Minutes and 0 seconds);

AdrockAlarmList1.Add(??:?7:00, Any Hour, but only x7 Minutes and 0 seconds);

AdrockAlarmList1.Add(10:11:23,10:11:23);

AdrockAlarmList1.Add(10:11:23,10:11:23);

AdrockAlarmList1.Add(10:11:22,10:11:22);

AdrockAlarmList1.Add(10:11:18,10:11:18);

AdrockAlarmList1.Add(15:11:18,3:11:18 PM);


Delete

Applies to

TAdrockAlarmList components

Declaration

method Delete(ItemToDelete : Integer);

Description

Calling this method will delete the item specified in the ItemToDelete variable. The item to delete is the number of the item in the list when it was added to the list.

You can also call the method DeleteByRef to delete the item that matches the reference string. This reference string is the string that was passed to the add method.

If you try to delete an Alarm that is not found then the EAlarmItemNotFound exception is raised.

Example:

{ Add a new alarm item }

AdrockListBox1Add(10:24:00, Chris);

{ Delete the alarm by the position of the alarm in the list. }

AdrockListBox1.Delete(0); { Delete the first item In the list }


DeleteByRef

Applies to

TAdrockAlarmList components

Declaration

method DeleteByRef(Ref : String);

Description

Calling this method will delete the item that matches the Ref variable. You can use this method if you do not know the position of the item you want to delete. If you know the item position that you want to delete you can call the Delete method.

If you try to delete an Alarm that is not found then the EAlarmItemNotFound exception is raised.

Example:

{ Add a new alarm item }

AdrockListBox1Add(10:24:00, Chris);

{ Delete the alarm by using the reference Chris that was used when the alarm was setup. }

AdrockListBox1.DeleteByRef(Chris);


TAdrockAlarmList

Applies to

TAdrockAlarmList components

Click here for the Contents Page