View Issue Details

IDProjectCategoryView StatusLast Update
0005255JEDI VCL04 Feature Requestpublic2012-02-29 16:53
ReporterjgagnonAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.39 
Target VersionFixed in Version3.45 
Summary0005255: A change to TJvAlarms/TJvAlarmItem
DescriptionI have need of a change to TJvAlarms/TJvAlarmItem to support an individual event being triggered for each TJvAlarmItem instead of a unified alarm event for TJvAlarms. My thought was to add the event to TJvAlarmItem and trigger that event when assigned instead of triggering the TJvAlarms event. That way, no existing code should be broken while still allowing individual events to be created and used.

Implementation specifics:

procedure TJvAlarms.DoAlarm(const Alarm: TJvAlarmItem;
  const TriggerTime: TDateTime);
begin
  if Assigned(Alarm.FOnAlarm) then
    Alarm.FOnAlarm(Alarm, TriggerTime)
  else if Assigned(FOnAlarm) then
    FOnAlarm(Self, Alarm, TriggerTime);
end;

Where the TJvAlarmItem.FOnAlarm type would be declared as follows:

  TJvAlarmItemEvent = procedure(Sender: TObject;
    const TriggerTime: TDateTime) of object;

Additions to TJvAlarmItem:

...
  private
    FOnAlarm : TJvAlarmItemEvent;
  published
    property OnAlarm : TJvAlarmItemEvent read FOnAlarm write FOnAlarm;
...

I think that would pretty much cover my needs.
Additional InformationI am capable of making the changes and testing them thoroughly, but I am completely new to the submission process and unsure how best to proceed. Should I just make the relatively minor changes to the JvAlarms.PAS file and submit it (zipped, of course) or do I create an extended version in a new source file and submit that instead or do I have one of you make the changes for me?

Thank you for your time.
TagsNo tags attached.

Activities

obones

2010-05-27 22:27

administrator   ~0017419

Best way to submit changes is to use a diff tool to attach just the diffs to the issue.
The best format for us is the one created by TortoiseSVN

2010-05-30 01:34

 

JvAlarms.diff (1,421 bytes)
--- JvAlarms.pas	Fri Aug 14 13:21:34 2009
+++ JvAlarms (2).pas	Sat May 29 19:22:24 2010
@@ -17,6 +17,7 @@
 Contributor(s):
 Michael Beck [mbeck att bigfoot dott com].
 Peter Th�rnqvist [peter3 at sourceforge dot net]
+Jerry Gagnon [jgagnon at paladus dot com]
 
 You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
 located at http://jvcl.delphi-jedi.org
@@ -40,17 +41,22 @@
   JvTypes, JvComponentBase;
 
 type
+  TJvAlarmItemEvent = procedure(Sender: TObject;
+    const TriggerTime: TDateTime) of object;
+
   TJvAlarmItem = class(TCollectionItem)
   private
     FName: string;
     FTime: TDateTime;
     FKind: TJvTriggerKind;
+    FOnAlarm : TJvAlarmItemEvent;
   public
     procedure Assign(Source: TPersistent); override;
   published
     property Name: string read FName write FName;
     property Time: TDateTime read FTime write FTime;
     property Kind: TJvTriggerKind read FKind write FKind;
+    property OnAlarm: TJvAlarmItemEvent read FOnAlarm write FOnAlarm;
   end;
 
   TJvAlarmEvent = procedure(Sender: TObject;
@@ -160,7 +166,9 @@
 procedure TJvAlarms.DoAlarm(const Alarm: TJvAlarmItem;
   const TriggerTime: TDateTime);
 begin
-  if Assigned(FOnAlarm) then
+  if Assigned(Alarm.FOnAlarm) then
+    Alarm.FOnAlarm(Self, TriggerTime)
+  else if Assigned(FOnAlarm) then
     FOnAlarm(Self, Alarm, TriggerTime);
 end;
 
JvAlarms.diff (1,421 bytes)

jgagnon

2010-05-30 01:36

reporter   ~0017424

Ok, I added the diff file with the changes. It was tested in D2007 but I don't really see anything that would negatively affect any other versions.

obones

2010-10-08 14:59

administrator   ~0017775

Thanks, this is now in SVN

Issue History

Date Modified Username Field Change
2010-05-26 20:51 jgagnon New Issue
2010-05-27 22:27 obones Note Added: 0017419
2010-05-27 22:27 obones Status new => feedback
2010-05-30 01:34 jgagnon File Added: JvAlarms.diff
2010-05-30 01:36 jgagnon Note Added: 0017424
2010-10-08 14:59 obones Note Added: 0017775
2010-10-08 14:59 obones Status feedback => resolved
2010-10-08 14:59 obones Fixed in Version => Daily / SVN
2010-10-08 14:59 obones Resolution open => fixed
2010-10-08 14:59 obones Assigned To => obones
2012-02-29 16:53 obones Fixed in Version Daily / SVN => 3.45