fix: ERangeError when editing text grid values which allow more than 2^31 chars, e.g. LONGTEXT

This commit is contained in:
Ansgar Becker
2026-01-27 16:05:16 +01:00
parent c8c3b23eae
commit 42b5d52fbb
3 changed files with 9 additions and 9 deletions

View File

@@ -38,7 +38,7 @@ type
function GetText: String;
procedure SetText(text: String);
procedure SetTitleText(Title: String);
procedure SetMaxLength(len: integer);
procedure SetMaxLength(len: Int64);
procedure SetFont(font: TFont);
property Modified: Boolean read FModified write SetModified;
end;
@@ -78,10 +78,10 @@ begin
end;
procedure TfrmBinEditor.SetMaxLength(len: integer);
procedure TfrmBinEditor.SetMaxLength(len: Int64);
begin
// Input: Length in bytes.
memoText.MaxLength := len * 2;
memoText.MaxLength := Integer(len * 2);
end;
procedure TfrmBinEditor.SetFont(font: TFont);

View File

@@ -74,7 +74,7 @@ type
private
FForm: TfrmBinEditor;
public
MaxLength: Integer;
MaxLength: Int64;
TitleText: String;
constructor Create(Tree: TVirtualStringTree; AllowEdit: Boolean; Col: TTableColumn); override;
destructor Destroy; override;
@@ -152,7 +152,7 @@ type
FPanel: TPanel;
FEdit: TEdit;
FButton: TButton;
FMaxLength: Integer;
FMaxLength: Int64;
procedure DoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ButtonClick(Sender: TObject);
public
@@ -164,7 +164,7 @@ type
function EndEdit: Boolean; override;
function PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean; override;
procedure SetBounds(R: TRect); override;
property MaxLength: Integer read FMaxLength write FMaxLength;
property MaxLength: Int64 read FMaxLength write FMaxLength;
end;
TColumnDefaultEditorLink = class(TBaseGridEditorLink)

View File

@@ -89,7 +89,7 @@ type
FClosingByCancelButton: Boolean;
FDetectedLineBreaks,
FSelectedLineBreaks: TLineBreaks;
FMaxLength: Integer;
FMaxLength: Int64;
FTableColumn: TTableColumn;
FHighlighter: TSynCustomHighlighter;
FHighlighterFormatters: TStringList;
@@ -99,7 +99,7 @@ type
function GetText: String;
procedure SetText(text: String);
procedure SetTitleText(Title: String);
procedure SetMaxLength(len: integer);
procedure SetMaxLength(len: Int64);
procedure SetFont(font: TFont);
property Modified: Boolean read FModified write SetModified;
property TableColumn: TTableColumn read FTableColumn write FTableColumn;
@@ -224,7 +224,7 @@ begin
end;
procedure TfrmTextEditor.SetMaxLength(len: integer);
procedure TfrmTextEditor.SetMaxLength(len: Int64);
begin
// Input: Length in number of bytes.
FMaxLength := len;