FNC Grid using VCL in Delphi 11.1

Using Delphi 11.1 Place a FNC Grid on a VCL form and putt also a standard button on the form. Use the code below to populate the grid and set the sort mode.

Now click several times on the header column 1 to sort the data. Click several times. Don't know why this is happening, but after every click data disappears until there is no data left. What is wrong?

Best regards,

procedure TForm1.Button1Click(Sender: TObject);
TMSFNCGrid1.Options.Sorting.Mode:= gsmNormal;
TMSFNCGrid1.Cells[1,1]:= '1';
TMSFNCGrid1.Cells[1,2]:= '8';
TMSFNCGrid1.Cells[1,3]:= '1';
TMSFNCGrid1.Cells[1,4]:= '7';
TMSFNCGrid1.Cells[1,5]:= '12';
TMSFNCGrid1.Cells[1,6]:= '19';
TMSFNCGrid1.Cells[1,7]:= '118';
TMSFNCGrid1.Cells[1,8]:= '5';

If I ad this line then all goes well.

TMSFNCGrid1.Cells[1,9]:= '5';

I guess that if not all rows are populated, it messes things up.

Gr. Fons


We'll investigate why this is the case, you can also just use an empty string, as long as all cells are initialized.

TMSFNCGrid1.Cells[1,9]:= '';

Hi Pieter,

Thanks, but it probably is as you already stated. It needs to be initialized.

Best regards,