I use windows 10 and seattle.
I try to change tStringGrid.RowCount without running onSelectCell event because there is a something which should not be run when a cell is not clicked or selected.
Sometimes changing tStringGrid.RowCount fires tStringGrid onSelectCell event. After implementing the following code with default tStringGrid, click the form -> click the button -> click any cell whose row index is bigger than 0 -> click the form again then onSelectCell event fires on the last clicking the form event.
I want to know whether this is a bug or I misunderstand something. In the former case I need bypass that and I can and in the latter case please let me know the reason to solve the problem.
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.RowCount := 5;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
StringGrid1.RowCount := 1; // at the second time this fires tStringGrid.onSelectCell Event
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
begin
Memo1.Lines.Add(IntToStr(ACol) + ' ' + IntToStr(ARow));
end;