You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently updated to V8.0.
In a tree with 45 columns, which allow the user to change the order, I am seeing an exception in some cases, with the error "The previous column must not have the same position as the given column."
Debugging the problem, I locate the origin in the function TVirtualTreeColumns.GetPreviousColumn:
function TVirtualTreeColumns.GetPreviousColumn(Column : TColumnIndex) : TColumnIndex;
// Returns the previous column in display order, Column is an index into the columns list.
var
Position : Integer;
begin
if Column < 0 then
Result := InvalidColumn
else
begin
Position := Items[Column].Position;
if Position > 0 then
Result := FPositionToIndex[Position - 1]
else
Result := InvalidColumn;
Assert(Position <> Result, 'The previous column must not have the same position as the given column.');
end;
end;
With this array of positions: FPositionToIndex = (0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 9, 43, 44, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 31, 42, 45, 41)
Without any repeated value, it throws the assert exception, for Column=41, and Position=45, but it should not.
I have realized that the Assert is comparing an index with a position, ... the correct thing would be
Assert(Result <> Column, 'The previous column must not have the same position as the given column.');
The text was updated successfully, but these errors were encountered:
I recently updated to V8.0.
In a tree with 45 columns, which allow the user to change the order, I am seeing an exception in some cases, with the error "The previous column must not have the same position as the given column."
Debugging the problem, I locate the origin in the function TVirtualTreeColumns.GetPreviousColumn:
With this array of positions:
FPositionToIndex = (0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 9, 43, 44, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 31, 42, 45, 41)
Without any repeated value, it throws the assert exception, for Column=41, and Position=45, but it should not.
I have realized that the Assert is comparing an index with a position, ... the correct thing would be
Assert(Result <> Column, 'The previous column must not have the same position as the given column.');
The text was updated successfully, but these errors were encountered: