TDBAdvGrid Hidden Columns Problem


we recently upgraded to the newest Version of the TMS Grid Pack.
My program now crashes with a RowIndex Error in combination with hidecolumns.

The Grid has a footer, PageMode is false.

Sample code (Shortened):

  Grid.UnHideColumnsAll(); // Recently added, in the past not needed
  dm.Query.Active := False;
  dm.Query.Active := True;
  Grid.Visible := dm.Query.RecordCount > 0;
  Grid.AutoSize := dm.Query.RecordCount > 0;

  if (dm.Query.RecordCount > 0) then
    Grid.AutoSizeRow(0,2); // For Captions with linebreaks
 //   Grid.HideColumns(Grid.Col-2,Grid.Col-1); // Crashes now, before it worked
    Grid.HideColumns(8,9); // This works now, last two column need to be hidden


I also tried RealCol but it didn't work. The second call of the procedure displays a grid with one column only.

Is there anything I can do to fix this? Otherwise I have to count the columns and search through the whole project. But this seems to be a huge step backwards.

I also tried Grid.Beginupdate and Grid.Endupdate, nothing changed.

Thanks in advance for your help.


I am not sure what the original intention was to use grid.Col in Grid.HideColumn(). 
Were you assuming that grid.Col was set to the last column as-is?

I'd not recommend this and rather use
grid.HideColumn(grid.ColCount - 2,grid.ColCount - 1);
to always make sure the last 2 columns are hidden.