Setting up Event Alerts
Go Up to Programming with Database Events
Double click on the ellipsis button (...) of the Events
property add an event to the Events
list. Each TIBEvents
component can handle up to 15 events. If you need to respond to more that 15 events, use more than one TIBEvents
component. If you attempt to add too many events at runtime, an exception will be raised.
To add an event to the Events
list use the following code:
TIBEvents.Events.Add( 'STOCK_LOW')
Writing an Event Handler
OnEventAlert
is called everytime an InterBase event is received by an IBEvents
component. The EventName
variable contains the name of the event that has just been received. The EventCount
variable contains the number of EventName
events that have been received since OnEventAlert
was last called.
OnEventAlert
runs as a separate thread to allow for true asynchronous event processing, however, the IBEvents
component provides synchronization code to ensure that only one OnEventAlert
event handler executes at any one time.