API:FireDAC.Comp.Client.TFDEventAlerter.OnAlert
Delphi
property OnAlert: TFDEventAlerterEvent read FOnAlert write FOnAlert;
C++
__property OnAlert;
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | published | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDEventAlerter |
Description
This event fires when a DBMS event is fired.
FireDAC.Comp.Client.TFDEventAlerter.OnAlert inherits from FireDAC.Comp.Client.TFDCustomEventAlerter.OnAlert. All content below this line refers to FireDAC.Comp.Client.TFDCustomEventAlerter.OnAlert.
This event fires when a DBMS event is fired.
Use the OnAlert event handler to specify an event handler that will be fired when one of the DBMS events specified in the FireDAC.Comp.Client.TFDCustomEventAlerter.Names property is fired. To start receiving event notifications, the events must be registered using the Register method or the Active property. The event handler can be fired in its own event alerter thread (False) or in the main application thread (True), depending on the Options.Synchronize option.
The event handler receives three arguments:
ASender
--The event alerter reference.AEventName
--Specifies the name of the event.AArgument
--Specifies the additional arguments to the event. The arguments are fully-DBMS and application-dependent. If no arguments are specified, there must be a Null or Unassigned value. It is a scalar variant value when only one argument is specified; otherwise, it is a variant array of values.
Example
procedure TForm1.FDEventAlerter1Alert(ASender: TFDCustomEventAlerter;
const AEventName: String; const AArgument: Variant);
begin
if CompareText(AEventName, 'Customers') = 0 then
qryCustomers.Refresh
else if CompareText(AEventName, 'Orders') = 0 then
qryOrders.Refresh;
end;