Use CellEditor MaxLength for strings editing

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2060 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo 2011-10-05 07:30:26 +00:00
parent 4080716092
commit b5d913b470

View File

@ -189,6 +189,7 @@ begin
CellEditor.Text := Field.AsString;
CellEditor.OnKeyPress := @OnKeyPress; // Recuperamos el control :-p
CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.MaxLength := fMaxLength;
updated := False;
CellEditor.SelectAll;
end;
@ -208,10 +209,7 @@ end;
procedure TJDbGridStringCtrl.OnKeyPress(Sender: TObject; var key: char);
begin
if (fMaxLength > 0) and (UTF8Length(CellEditor.Text) >= fMaxLength) then
key := #0
else
edited := True;
edited := True;
end;
procedure TJDbGridStringCtrl.OnKeyDown(Sender: TObject; var Key: word;