Well, just prepare 2 variables of Integer that saves the latest cell coordinates. For example:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Grids,
StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure StringGrid1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
var
PrevCol,PrevRow: Integer;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
PrevCol:=0;
PrevRow:=0;
end;
procedure TForm1.StringGrid1Click(Sender: TObject);
begin
Label1.Caption:='PrevCol: '+IntToStr(PrevCol)+
' PrevRow: '+IntToStr(PrevRow);
PrevCol:=StringGrid1.Col;
PrevRow:=StringGrid1.Row;
end;
initialization
{$I Unit1.lrs}
end.
See the changes in the Label1.