Problem with CellControls in TAdvStringGrid after hiding a column

Hello!

I am using the TAdvStringGrid and am experiencing the following problem. I create a grid with 8 columns and 10 rows and fill the 4th (0-Index) column with Buttons:

TAdvStringGrid* Grid = new TAdvStringGrid(AOwnerForm);
Grid->Parent = AOwnerForm;
Grid->Align = alClient;

// 8 columns, 10 rows
Grid->ColCount = 8;
Grid->RowCount = 10;

// Header row
for (int col = 0; col < 8; ++col)
  Grid->Cells[col][0] = IntToStr(col);

for (int row = 1; row < 10; ++row)
{
  TAdvGlowButton* btn = new TAdvGlowButton(Grid);
  btn->Parent = Grid;
  btn->Caption = "Btn";
  Grid->CellControls[4][row] = btn;
}

I get the following grid:

I then add the following line to hide the very first Column:

Grid->HideColumn(0);

I then get the following grid. The column of buttons is no longer aligned with the intial column (4) and has shifted to the right by one (5):

Is this a bug or is there another approach that I can take?

Thanks in advance!
Masami

(C++Builder Tokyo, VCL UI Pack 13.5.8.0)

We are able to reproduce this issue and will look into this asap.

1 Like

We traced & solved this issue. Next update will address this.

Possible workaround for now:

begin
advstringgrid1.BeginUpdate;
advstringgrid1.SuppressColumn(0);
advstringgrid1.EndUpdate;
end;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.