Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: kacorPosted on 2005-04-07 at 03:36:40ID: 13725411
Hi PinoyBug,
TObject);
(Sender: TObject; EventName: String;
I used only InterBase and Delphi so I can help in the followings to your question:
".. seems to refer to subscribing to an event on a table with an existing event created"
In InterBase you have to create first a trigger. InterBase has the command POST_EVENT and this informs the event handler when the event occurs (the SET TERM is needed for compatibility only):
SET TERM ^;
CREATE TRIGGER TR_NewOrder
FOR Orders
ACTIVE AFTER INSERT
AS
BEGIN
POST_EVENT ’New order’;
END^
SET TERM ;^
Between the IBExpress components of Delphi there is the IBEvents component. First you register the IBEvents:
procedure TForm1.FormCreate(Sender: TObject);
begin
IBDatabase1.Connected := True;
IBTransaction1.Active := True;
IBEvents1.Registered := True;
end;
procedure TForm1.FormDestroy(Sender:
begin
IBEvents1.Registered := False;
IBDatabase1.Connected := False;
end;
In the Events property of the IBEvents component you write in the "new order" event. The IBEvents component has the event "OnEventAlert". To handle this event alerter you can use the following procedure for example:
procedure TForm1.IBEvents1EventAlert
EventCount: Integer; var CancelAlerts: Boolean);
begin
Application.BringToFront;
MessageDlg('Delphi message: ' + EventName + ' event has occured.',
mtInformation, mbOKCancel, 0);
end;
To stop the alerts you can use the CancelEvents, or restart alerting by QueueEvents method.
If a new order will be inserted you'll get the ’New order’ message.
I hope this helps
wbr kacor