Subject Re: [IBO] Access Violation with OnFilterRecord in TIBOTable
Author Geoff Worboys
> If I use TIBOTable and set Filtered := true, assign the
> EventHandler for OnFilterRecord I get an EAccessViolation in
>
> function TIB_BDataset.CheckRecordFilter( ARow: TIB_Row ): boolean;
> begin
> Result := true;
> if ( ARow.RowState <> rsNone ) and Assigned( FOnFilterRecord )
then
> OnFilterRecord( ARow, Result );
> end;
>
> The debugger tells me OnFilterRecord is not available.
>
> I tested it also with TIBOQuery and it worked fine.

If you check out IBDataset.pas you will see where the
SetOnFilterRecord procedure has been overridden to assign a special
handler (RecordFilter in the TIBODataset) to the internal dataset.
You could stick a break point in the SetOnFilterRecord so that you can
check that the assignment is taking place when the form/module is
loaded at startup.


> Can anyone tell me if this is a bug or did I make a mistake ???
>
> If I create the EventHandler with the ObjectInspector in Delphi I
get
>
> procedure Tdbconn.TreeTabFilterRecord(DataSet: TDataSet;
> var Accept: Boolean);
>
> so this might explain why the handler is not available when I try to
> call it with a TIB_Row parameter.

This is correct - it is the TDataset OnFilterRecord event. If you
check out the SetOnFilterRecord event you will see how this results in
the call to TIBODataset.RecordFilter and then to your actual handler.


One of the things that is done via this processing is some special
handling of computed fields. Is there any chance that you have a
problem with your computed fields somewhere? Try putting a breakpoint
in the TIBODataset.RecordFilter procedure to see if it ever gets
called (if so then the internal dataset OnFilterRecord must be
working). If you do get a hit on that procedure debug through to see
if the AV occurs while in that procedure.


Try posting us the actual callstack when the exception occurs, it may
offer a few more ideas.


HTH

Geoff Worboys
Telesis Computing