unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    procedure StringGrid1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char);
begin
with StringGrid1 do
   if Key=#13 then
   begin
    {tu można dodać formatowanie tekstu w komórce}
     if Row=RowCount-1 then RowCount:=RowCount+1;
     EditorMode:=false;
     Selection:=TGridRect(Rect(Col, Row+1, Col, Row+1));
     if Row>=(TopRow+VisibleRowCount) then TopRow:=TopRow+1;//
   end;
end;

end.
