Subject RE: [IBO] IB_Grid and SrollBar issues.
Author Helen Borrie
Christopher Hart wrote:

> > This is how IB_Objects Grids are designed. It makes the application
> > much more responsive to only bring in the records are immediately
> > needed. If you want to have all records ready for the Grid you will
> > need to do A FetchAll.

At 11:00 AM 16/05/2005 +1000, you wrote:

>Hi Christopher,
>
>I have definitely set the AutoFetchAll = true. But the problem remains.

The dataset has no way, ahead of time, to know how many rows it will
receive. It adjusts the thumb on the scrollbar as the size of the row
buffer increases.

Setting AutoFetchAll *does* force the dataset to fetch all rows. But the
IB_Datasource will continue its default behaviour of adjusting the
scrollbar as it "counts in" the selected records.


>Please correct me if I have miss interpret you. So my understanding, is that
>by setting AutoFetchAll = true, the scroll bars on IB Grid, will not display
>a true representation of the number of records. For this to work correctly,
>I can only fetch a small number of records?

If the number of records is very large, you won't get it to work the way
you want it to by this method alone.

If you really want to hold up your interface while waiting for all of the
rows, open the dataset inside a DisableInterface block. If you want to go
the AutoFetchall route, this should have the desired effect:

with MyGrid.Datasource do
begin
DisableInterface;
try
Dataset.Open;
finally
EnableInterface;
end;
end;

Calling FetchAll yourself conditionally at runtime is probably preferable
to setting AutoFetchAll, since it allows you to let the user decide which
behaviour s/he wants - a crazy thumb versus a slow interface.

with MyGrid.Datasource do
begin
DisableInterface;
try
if not Dataset/Prepared then Dataset.Prepare;
if UserWantsSlow then
Dataset.FetchAll
else
Dataset.Open;
finally
EnableInterface;
end;
end;

Helen