AnyDAC
ContentsIndexHome
PreviousUpNext
TADCustomEventAlerter.OnAlert Event

The event fires, when a DBMS event is fired.

Group
Links

Use the OnAlert event handler to specify an event handler, which will be fired when one of the specified in the Names DBMS events is fired. To start receive event notifications, the events must be registered using the Register method or the Active property. The event handler may be fired in the 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 is 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. There must be a Null or Unassigned value, if no arguments are specified. The scalar variant value, when only single argument is specified. Or an variant array of values.
property OnAlert: TADEventAlerterEvent;
procedure TForm1.ADEventAlerter1Alert(ASender: TADCustomEventAlerter;
    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;
What do you think about this topic? Send feedback!