在OnGetEditMask,OnGetEditText事件中可以控制输入格式和长度:
例:
procedure TFrmMain.InputGridGetEditText(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
if Length(Trim(InputGrid.Cells[2,ARow]))=14 then InputGrid.Cells[2,ARow]:=Copy(Trim(InputGrid.Cells[2,ARow]),1,13);
if Length(Trim(InputGrid.Cells[2,ARow-1]))=14 then InputGrid.Cells[2,ARow]:=Copy(Trim(InputGrid.Cells[2,ARow-1]),1,13);
end;
procedure TFrmMain.InputGridGetEditMask(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
Case ACol of
2: Value:='>L00/-0000/-0000/-0000;1;';
3: Value:='>L;1;';
end;
end;