FireDAC.Comp.Client.TFDCustomEventAlerter.OnAlert

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnAlert: TFDEventAlerterEvent read FOnAlert write FOnAlert;

C++

__property TFDEventAlerterEvent OnAlert = {read=FOnAlert, write=FOnAlert};

Properties

Type Visibility Source Unit Parent
event public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDCustomEventAlerter

Description

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;

See Also