procedure TBSDataSet.EnsureLoaded(AAfterLoad: TNotifyEvent);
var
n : Integer;
begin
if State <> dsClosed then begin
AAfterLoad(Self); <<<<< here I get a compiler error
Exit;
end;
...
end;
It works fine, if I assign AAfterLoad to a variable in the class
itself first.