IDataGridCompareEventArgs.RightRow

Syntax

RightRow: Integer;

Description

The RightRow property returns the index of the second string to compare.

Example

Executing the example requires a form with the Button1 button and the DataGrid component named DataGrid1.

Class TestForm: Form

DataGrid1: DataGrid;

Button1: Button;

Rows: IDataGridRows;

 

Sub DataGrid1OnCompareItems(Sender: Object; Args: IDataGridCompareEventArgs);

Var

s1, s2: String;

Begin

s1 := Rows.Item(Args.LeftRow).ColumnValue(0);

s2 := Rows.Item(Args.RightRow).ColumnValue(0);

If s1.Length > s2.Length Then

Args.Compare := 1;

Elseif s1.Length < s2.Length Then

Args.Compare := -1;

Elseif s1.Length = s2.Length Then

Args.Compare := 0;

End If;

End Sub DataGrid1OnCompareItems;

 

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Begin

Rows := DataGrid1.Rows;

DataGrid1.SortType := ControlSortType.Custom;

DataGrid1.EnableSort := True;

DataGrid1.Columns.Item(0).SortIndex := 0;

DataGrid1.Columns.Item(0).SortAscending := False;

End Sub Button1OnClick;

End Class TestForm;

After executing the example, clicking the button starts custom sorting by the values of the first component column. Strings are descending ordered.

See also:

IDataGridCompareEventArgs