can't add new row and highlight it when it almost reaches the bottom of Webstringgrid

Hi Bruno,

Hope you are doing well.

I have a button to add a new row to a string grid and also I would like to highlight the newly added row to TWebStringGrid. However, when I continued to add new row until the last almost reached the bottom of string grid, then I can't add more since the page got stuck:

WebStringGrid1.rowCount := WebStringGrid1.rowCount +1;
WebStringGrid1.row := WebStringGrid1.rowCount-1;

Here is the demo:
34. add new row and highlight it.zip (2.0 MB)

Thanks,

Hi,

Use BeginUpdate/EndUpdate:

procedure TForm2.WebButton1Click(Sender: TObject);
begin
  WebStringGrid1.BeginUpdate;
  WebStringGrid1.RowCount := WebStringGrid1.RowCount + 1;
  WebStringGrid1.Row := WebStringGrid1.RowCount - 1;
  WebStringGrid1.EndUpdate;
end;

Works pretty well. Thanks!

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