3

I decided to try the JvAlarms component. So I did :

procedure TForm1.Button1Click(Sender_TObject);
begin
jvAlarms1.Add.Name :=Edit1.Text;
jvAlarms1.Add.Time := dxDateTimeWheelPicker1.DateTime;
label1.caption:=datetimetostr(dxDateTimeWheelPicker1.DateTime);
jvAlarms1.Active:=True;
end;

Now, the strange part is that when I set the alarm and run the application,immediately I get a popup window with my alarm message. Is this by design ? After I close this message the application will later trigger the alarm I have set on time.I am just wondering if this immediate popup window is by default or you can turn it off and how. If you can not, is it possible to modify it so you can at least say something to the user like 'you have set the alarm : alarm name, to fire : alarmtime'.

Second question regards the alarm message. How do you get the alarm message name when the alarm fires ?

I tried :

ShowMessage('Alarm:'+ jvAlarms1.Name);

but it does not seem to work. I can get it with :

ShowMessage('Alarm:'+jvAlarms1.Items[0].Name;

But I do not know the indexes of the alarms added!? So I can not use that. Any way I can retrieve the list of alarms added by my code ?

Third question regard the alarms storage. Do you load them from *.ini or can you use a database ? I could not find examples of such usage anywhere (over here search results turn '0') so I would be grateful if someone could point me in the right direction.

user3351050
  • 368
  • 2
  • 11
  • You need to learn how this site works. This is a *question and answer* site. Note that it's not *questionS* - question is singular. The general rule is one question per post; that can sometimes be extended to two, if they're closely related. It doesn't extend beyond that, and we don't write tutorials here. If you have multiple questions, create separate posts and ask them; if you need to refer to previous details, you can link to previous questions from the new one(s). And with open source component libraries (JEDI in particular), you're going to need to dive into the source; no docs. – Ken White Dec 31 '16 at 03:49

1 Answers1

0

You added two alarms because you called Add twice. Call it once instead:

var
  Item: TJvAlarmItem;
.... 
Item := jvAlarms1.Add;
Item.Name :=Edit1.Text;
Item.Time := dxDateTimeWheelPicker1.DateTime;

When the alarm fires the component's OnAlarm event receives a reference to the specific alarm that fired. You can read the name from that reference.

It is entirely up to you where you store the alarms in your application.

David Heffernan
  • 572,264
  • 40
  • 974
  • 1,389
  • when these alarms fire, do they after get cleared (deleted) by themselves or...? If you use database or ini, then you must use a timer ? There is no documentation on how to do this . Ok Ken, I will heed your advice. Perhaps better. – user3351050 Dec 31 '16 at 03:52
  • @user3351050: Not well, apparently. :-) Now you're trying to ask two additional questions in comments. Please read my comment to your question again - if you have new questions, **create a new post and ask them there**. – Ken White Dec 31 '16 at 06:06
  • @David Heffernan will : Item:=jvAlarms1.Add; compile ? I think not. – user763539 Dec 31 '16 at 07:05
  • It wont ...Not enough actual parameters... :) – user763539 Dec 31 '16 at 15:36
  • @user763539 Explain the code in the question then? It would seem that the asker has a different version of JEDI. – David Heffernan Dec 31 '16 at 15:37
  • @user76 Look at the code in the question. I've just followed the lead set there. – David Heffernan Dec 31 '16 at 16:25