home *** CD-ROM | disk | FTP | other *** search
- unit Entgrid;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, Grids;
-
- type
- TEnterGrid = class(TStringGrid)
- private
- { Private declarations }
- protected
- { Protected declarations }
- procedure KeyPress(var Key: Char); override;
- public
- { Public declarations }
- published
- { Published declarations }
- end;
-
- procedure Register;
-
- implementation
-
- procedure Register;
- begin
- RegisterComponents('Samples', [TEnterGrid]);
- end;
-
- procedure TEnterGrid.KeyPress(var Key: Char);
- begin
-
- if Key = #13 then
- begin
- if Col < (ColCount - FixedCols) then
- begin
- Col := Col + 1;
- Key := #0;
- end
- else if Row < (RowCount - FixedRows) then
- begin
- Col := 1;
- Row := Row + 1;
- Key := #0;
- end;
- end;
-
- if Key <> #0 then inherited KeyPress(Key);
-
- end;
-
- end.
-