lcl: fix THeaderSections.AddItem (bug #0013806 by Hans-Peter Diettrich)

git-svn-id: trunk@20162 -
This commit is contained in:
paul 2009-05-24 10:19:02 +00:00
parent a8544fc87d
commit a67684a1a6

View File

@ -433,10 +433,13 @@ begin
end;
function THeaderSections.AddItem(Item: THeaderSection; Index: Integer): THeaderSection;
var i:longint;
var
i: longint;
begin
if Item = nil then
Result := FHeaderControl.CreateSection;
Result := FHeaderControl.CreateSection
else
Result := Item;
Result.Collection := Self;
if Index > Count then
@ -444,11 +447,10 @@ begin
Result.Index := Index;
//updates OriginalIndex so that it has the value Index would have if there
//never was a move
for i:=0 to Count - 1 do
if Items[i].FOriginalIndex>=Index then
Items[i].FOriginalIndex:=Items[i].FOriginalIndex + 1;
for i := 0 to Count - 1 do
if Items[i].FOriginalIndex >= Index then
Items[i].FOriginalIndex := Items[i].FOriginalIndex + 1;
Result.FOriginalIndex := Index;
end;
function THeaderSections.Insert(Index: Integer): THeaderSection;