DBAdvGrid AddScrollbar dataset refresh

After I create a dataset I add scrollbar to all the rows in a DBAdvGrid using the following function:


AddScrollBarsToGrid(DBAdvGrid1);

procedure TfrmDebtDetails.AddScrollBarsToGrid(theGrid: TDBAdvGrid);
var
    i: integer;
begin
    for i := 1 to theGrid.RowCount - 1 do
        theGrid.AddScrollBar(2, i, True);
end;

However, when I Refresh the associated dataset the data is updates but no scrollbars added. As in:

Dataset1.Refresh;
AddScrollBarsToGrid(DBAdvGrid1);

Yet, no scrollbars on the Refreshed/Reloaded grid.
How can I get the DBAdvGrid1 to show the scrollbars with the refreshed dataset?

brian.lewis
.

In order to use cell access this way, please set grid.PageMode = false.

PageMode is set to False.


I placed the call to my AddScrollBarsToGrid(DBAdvgrid1) function in the DataSet.AfterLoad event. That works fine. 

However, once the dataset is refreshed and I update the grid, it does not work.

Ok.. I believe I know what the issue is. It seems to be one of the timing of creating the Scrollbars.


With a small sample as in the example, the grid is created quickly and everything works fine. However, with a larger dataset it takes may take a second of two and that means the Scrollbar creation process gets messed up.

I was able to check this by putting the DBAdvGrid1.Reload on a button click event. And then my AddScroolBarsToGrid(DBAdvGrid1) function on another button click event.

As such all I ought to need do is place my function call after all rows have been added to the grid.

Can you tell me what DBAdvGrid event is fired after all rows have been added to the grid?


The DBGrid works far too slowly. The regular AdvStringGrid is easier and works faster so I dumped the DBAdvGrid approach and create from the dataset instead.