IBEvents...

Hi all, Jeff,

The IBEvents Demo you had post at CC was enough to learn how I should use
it, but I still with 2 questions :

I had registered a event called 'POST', so I had associated it with a
trigger for one table, so, on EventAlert, I call a procedure called
fForceRefresh with these code below, it made a call and almost everything is
perfect. The only problem is that the record inserted isn't shown. It
appears only if I close the form and reopen.

I have more than one Dataset linked to the Transaction in a form, I open
them (other dataset) to increase performance with Lookup fields, that open
the Dataset with the default transaction, and I don't want this to happen,
that's because My program will be running all day, and as Jeff said, isn't
good leave a transaction opened all day, to help garbage collector. So...

- Do I need to close the transaction even closing and reopening the Dataset
? What will happen with other tables that's is linked with it. Note that
fForceRefresh is a general procedure, to use with any dataset...

The 2nd question is:
- Is there a way to use the same trigger for several table ? (like the one
that's used with events)

Thanks all...

--
Alexandre
ICQ 38231359
the code follows below...

The code of fForceRefresh, and a general procedure for DM
(* ----------------------------- *)
    GENERAL PROCEDURE
(* ----------------------------- *)
This is used within DM to check all Datasets

procedure TdmDados.fCallRefresh(Sender: TObject);
Var
   x : Integer;
begin
   if not IBDatabase.DefaultTransaction.Active Then
      IBDatabase.DefaultTransaction.Active := True
   Else
      IBDatabase.DefaultTransaction.Tag := 1;

   for x := 0 to IBDatabase.DataSetCount - 1 do
      Begin
            if (IBDatabase.DataSets[x].State = dsBrowse) Then
               fForceRefresh(IBDatabase.DataSets[x]); <<<<<<==========
      End;

   if IBDatabase.DefaultTransaction.Tag=1 Then
      IBDatabase.DefaultTransaction.Tag:=0
   Else
      IBDatabase.DefaultTransaction.Active := False;
end;

(* ----------------------------- *)
    fForceRefresh PROCEDURE
(* ----------------------------- *)
Procedure fForceRefresh(ibQuery : TDataSet);
Var
   bmPosition : TBookMark;
Begin
ibQuery.DisableControls;
bmPosition := ibQuery.GetBookMark;
ibQuery.Close;
ibQuery.Open;
   if IBQuery.RecordCount <> 0 Then
      Try
         ibQuery.GotoBookMark(bmPosition)
      Except
         ShowMessage('This record was deleted by another user...');
      End;
ibQuery.FreeBookMark(bmPosition);
ibQuery.EnableControls;
End;