Skip to content

Commit

Permalink
Fix for #1179
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmarder committed Mar 11, 2023
1 parent 7229c2a commit c69e0f8
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions Source/VirtualTrees.Header.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2704,16 +2704,14 @@ procedure TVTHeader.RestoreColumns;
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TVTHeader.ToggleSortDirection;

// Toggles the current sorting direction

begin
if SortDirection = sdDescending then
SortDirection := sdAscending
else
SortDirection := sdDescending;

procedure TVTHeader.ToggleSortDirection;
// Toggles the current sorting direction
begin
if SortDirection = sdDescending then
SortDirection := sdAscending
else
SortDirection := sdDescending;
end;

//----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -4407,6 +4405,17 @@ procedure TVirtualTreeColumns.FixPositions;
I : Integer;

begin
// Fix positions that too large, see #1179
for I := 0 to Count - 1 do
begin
if Integer(Items[I].Position) >= Count then
begin
UpdatePositions(True);
break;
end;
end; // for

// Update position array
for I := 0 to Count - 1 do
FPositionToIndex[Items[I].Position] := I;

Expand Down

0 comments on commit c69e0f8

Please sign in to comment.