[Lazarus] Proper implementation of TDataLink descendant

Alexander Klenin klenin at gmail.com
Thu Aug 4 18:46:46 CEST 2011


2011/8/5 Michael Van Canneyt <michael at freepascal.org>:
>> 1) Is there a way to totally disable DataSetChanged events in the dataset?
>
> No.
>
> You only disable the treatment of the event while browsing.
>
> Something like
>
> If not Floading then
>  LoadChart;
>
> Procedure LoadChart;
>
> begin
>  Floading:=True;
>  try
>    // Browse data and build series.
>  finally
>    Floading:=False;
>  end;
> end;

Of course I already do that.
The problem is that it does not help -- see the bug report I linked to.
I need to disable the events in the dataset itself.
Will the patch adding this capability be accepted?

>> 2) Alternatively, is there a mechanism to read entire dataset via
>> TDataLink without fully buffering it?
>
> No, for obvious reasons. I think that for the tchart, you should not bother
> with the buffer mechanism. Just do a
>
>  First;
>  While not EOF do
>    begin
>    AddPointToSeries;
>    Next;
>    end;

This is (almost) exactly what I did. You can look yourself at the
TADbSource unit.
The problem is, it does not work, as I described in the first mail.
What are the obvious reasons you refer to?
I did not yet study the dataset/datalink implementation fully,
so they are not obvious to me.

> A chart always sees the dataset as a whole. DB aware controls normally see
> only 1 record.
> Normally, a grid sees as much records as it currently displays rows.
>
> But many advanced grids also browse the whole dataset when building rows;
> they don't bother with Activebuffer and buffercount. (

Such grids either fail in the same way TDbChartSource does,
or use some other mechanism I am not aware of.

-- 
Alexander S. Klenin




More information about the Lazarus mailing list