« Reply #9 on: November 20, 2022, 07:47:14 pm »
Here the OnClick event of the grid for this
procedure TForm1.StringGrid1Click(Sender: TObject);
var
ARect: TGridRect;
begin
ARect.Left := 0; // column start
ARect.Top := StringGrid1.Row; // new selected row
ARect.Height := 0;
ARect.Width := StringGrid1.ColCount;
StringGrid1.Selection := ARect;
// get the data of col 1 and the selected row
ShowMessage(StringGrid1.Cells[1, StringGrid1.Row]);
end;
In this example is the clicked cell not highlighted, you can do this only with the options of the StringGrid goRowSelect.
« Last Edit: November 20, 2022, 07:58:08 pm by itblumi »

Logged
Jan
Delphi XE6, Lazarus 2.2.4, Visual Studio, Eclipse
Platforms: Ubuntu 22.10, Windows 7, 10
Progarmming languages: Pascal, C, C++, C#, Java