mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:59:14 +02:00
LCL: fix crash in TStringGrid.InsertRowWithValues is Columns.Enabled is True. Issue #0036067
git-svn-id: trunk@61946 -
This commit is contained in:
parent
96eee65d5d
commit
ed3cfadcf4
@ -11761,11 +11761,19 @@ end;
|
|||||||
procedure TCustomStringGrid.InsertRowWithValues(Index: Integer;
|
procedure TCustomStringGrid.InsertRowWithValues(Index: Integer;
|
||||||
Values: array of String);
|
Values: array of String);
|
||||||
var
|
var
|
||||||
i, OldRC: Integer;
|
i, OldRC, Diff: Integer;
|
||||||
begin
|
begin
|
||||||
OldRC := RowCount;
|
OldRC := RowCount;
|
||||||
if Length(Values) > ColCount then
|
Diff := Length(Values) - ColCount;
|
||||||
ColCount := Length(Values);
|
if Diff > 0 then
|
||||||
|
begin
|
||||||
|
if Columns.Enabled then
|
||||||
|
begin
|
||||||
|
for i := 1 to Diff do with Columns.Add do Title.Caption := '';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ColCount := Length(Values);
|
||||||
|
end;
|
||||||
InsertColRow(false, Index);
|
InsertColRow(false, Index);
|
||||||
//if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup)
|
//if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup)
|
||||||
//which is unwanted here, so reset it (Issue #0026943)
|
//which is unwanted here, so reset it (Issue #0026943)
|
||||||
|
Loading…
Reference in New Issue
Block a user