Permalink
Browse files

Add a missing file for #22232

git-svn-id: http://svn.freepascal.org/svn/lazarus/trunk@37649 4005530d-fff6-0310-9dd1-cebe43e6787f
  • Loading branch information...
JuhaManninen committed Jun 14, 2012
1 parent 9bf0760 commit b768061cd4222d97032e9ce540196a42c5d5373b
Showing with 79 additions and 0 deletions.
  1. +79 −0 components/sqldb/pqteventmonitor.pas
@@ -0,0 +1,79 @@
+unit PQTEventMonitor;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes,PQEventMonitor,ExtCtrls;
+
+
+type
+
+ { TPQTEventMonitor }
+
+ TPQTEventMonitor=class(TPQEventMonitor)
+ private
+ Fpoll: integer;
+ Timer:TTimer;
+ function GetPollInterval: integer;
+ procedure OnTimer(Sender: TObject);
+ procedure SetPollInterval(AValue: integer);
+ public
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
+ procedure RegisterEvents; override;
+ procedure UnRegisterEvents; override;
+ published
+ property PollInterval:integer read GetPollInterval write SetPollInterval default 500;
+ end;
+
+implementation
+
+
+{ TPQTEventMonitor }
+
+procedure TPQTEventMonitor.SetPollInterval(AValue: integer);
+begin
+ if Timer.Interval=AValue then Exit;
+ Timer.Interval:=AValue;
+end;
+
+function TPQTEventMonitor.GetPollInterval: integer;
+begin
+ result:=Timer.Interval;
+end;
+
+procedure TPQTEventMonitor.OnTimer(Sender: TObject);
+begin
+ Poll;
+end;
+
+constructor TPQTEventMonitor.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ Timer:=TTImer.Create(self);
+ Timer.Interval:=500;
+ Timer.Enabled:=false;
+ Timer.OnTimer:=@OnTimer;
+end;
+
+destructor TPQTEventMonitor.Destroy;
+begin
+ inherited Destroy;
+end;
+
+procedure TPQTEventMonitor.RegisterEvents;
+begin
+ inherited RegisterEvents;
+ Timer.Enabled:=true;
+end;
+
+procedure TPQTEventMonitor.UnRegisterEvents;
+begin
+ Timer.Enabled:=false;
+ inherited UnRegisterEvents;
+end;
+
+end.
+

0 comments on commit b768061

Please sign in to comment.