TStringGrid - previous position of selected cell lazarus / 7-LCL ---------------------------------------------------------------------- bedla · 2007-12-10 11:02 Hi, I need help. I want to check a value in a cell of a stringgrid (in editing mode).  I write some numbers to the cell and then I click to another cell. Now, I need to check a content of the previous cell if one contains the right value (e.g. > 0). How do I find out corodinates of the previous cell after click to another cell and to choose previous cell again?  I tried to get it in evetns editingdone, selectcell, but without avail. ---------------------------------------------------------------------- Leledumbo · 2007-12-10 11:25 Well, just prepare 2 variables of Integer that saves the latest cell coordinates. For example: Code: [Select] 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. ---------------------------------------------------------------------- bedla · 2007-12-10 21:53 Thanks. It helped me.