Skip to main content
Table of Contents

TTMSFNCDataGridDataCustomCompareCallback Event Type

Compares two cell values of a column during a sort or grouping operation, before the built-in comparison runs.

API unit family: TMSFNCDataGridData

Remarks

Always return the ascending order: the result is negated afterwards when the column sorts descending. The callback is invoked for every comparison, so keep it fast and free of side effects.

Parameters

Name Description
AColumn Zero-based index of the column being compared.
ARow1 Zero-based row index of the first value.
ARow2 Zero-based row index of the second value.
AData1 Cell value from the first row.
AData2 Cell value from the second row.
ALevel Zero-based grouping level whose rows are sorted, or 0 for a sort outside grouping.
AHandled Initialized to False. Set it to True to use the returned value; leave it False to fall back to the built-in comparison for this pair.

Returns

A negative value when the first value sorts before the second, 0 when they are equal, or a positive value otherwise. Only used when AHandled is True.