Topic: Adding timer

Hello
It appears that it may be possible to add a timer to a form after looking at the "Russian" forum section but not speaking Russian not clear as to what the procedure is to do this.
What I had in mind was a script  that fired every 10 mins , perform an SQL query and pop up a message if record(s) found  -- like a appointment reminder.
Any chance of a sample file of  the way to achieve this?

Re: Adding timer

Hello,


I made example for you.

var
   Timer: TTimer;

procedure Form1_OnShow (Sender: string; Action: string);
begin
     Timer := TTimer.Create (nil);
     Timer.OnTimer := @OnTimer;
     Timer.Interval := 600000 ; // value in ms = 10 min
     Timer.Enabled := True;
end;

procedure OnTimer;
var
    s: string;
begin
     s := SQLExecute ('SELECT COUNT(id) FROM employees WHERE lastname = "Smith"');
     if StrToInt(s) > 0 then ShowMessage('Record found');
end;

procedure Form1_OnClose (Sender: string; Action: string);
begin
     Timer.Free;
end; 

begin

end. 



Here you can download example project:

Post's attachments

Attachment icon Employees search by timer.zip 5.89 kb, 623 downloads since 2014-11-30 

Dmitry.