I think I ran into a bug in TDBAdvGrid component.
When scroll using mouse in TDBAdvGrid. The new cell in the bottom of the grid from the fixed columns are left empty without their contents. Here is how to recreate the problem
- Add a TDBAdvGrid to your form. Add a TADOQuery and TDatasource to this form. Set Dataset property in the datasource to point to this query. Assign datasource to the grid.
-Set FixedCol = 1 for the grid from the properties editor in form designer
- Write code for event Onformactivate to assign a sql text to above query to open a table in your database (example: select * from ATABLE)
-After Query.Open command in your code, assign Fixedcol:=2 after the query opened. Now the first column which contain the first field in the query becomes fixed column. the code should look like this:
Query1.SQL.Text := 'SELECT * FROM ATABLE';
myDBGrid.FixedCols := 2;
-Now scroll the grid down using mouse scroll button. All the normal cells appear from the bottom of the grid correctly, but the fixed column cells (first field's cells) are empty.
- If I scroll the grid using arrow keys in the keyboard, the content of the fixed column are correctly filled.
If I set FixedCol = 2 at the design time, the first and the 2nd columns are empty after the query opened. The first field in the query appear in the 3rd column of the grid.
Could you please check and fix the problem.
Oh, I forgot to mention in my last post. The grid version is: 18.104.22.168
I have retested this here with the latest version v22.214.171.124 but I cannot see such problem.
I tried to upgrade our TMS VCL package here and still see the problem with v126.96.36.199. If you use code to modify Fixedcols to any number >= 2, the fixed cols are not refreshed if the user scrolls the grid with scroll button on the mouse or move thumb button on the scrollbar (make sure to set thumb tracking := true)
We have investigated this here again and after deeper research, it appears the issue manifests itself here in a different way. We have applied a fix for it though and the next release will have this fix.
Thank you for the quick fix.
I also concern about the way FixedCols property behaves. If I set FixedCols=2 (or more) at form designer, the component creates 2 (or more) fixed empty columns without the content. I thought the 1st fixed column is for the row marker and the 2nd column, the cells will represent the 1st field value of the dataset, not just empty cells.
However, it will work correctly if I assign Fixedcols from the code.
It is by design that when the dataset is activated, the auto column creation starts from the first normal cell, i.e. after the existing fixed columns.
To override, change grid.FixedCells after activating the dataset.