IDimensionViewerCompareEventArgs.Compare

Syntax

Compare: Integer;

Description

The Compare property determines whether sorting is enabled.

Comments

One of the following values must be set for the property:

Example

Executing the example requires a form with the Button1 button and the DimensionTree component named DimensionTree1. Elements in the second column contain integer values.

Class TestForm: Form

DimensionTree1: DimensionTree;

UiDimension1: UiDimension;

Button1: Button;

AttrInst: IDimAttributeInstance;

 

Sub DimensionTree1OnCompareItems(Sender: Object; Args: IDimensionViewerCompareEventArgs);

Var

i, j: Integer;

Begin

i := AttrInst.Value(Args.LeftItem);

j := AttrInst.Value(Args.RightItem);

If i > j Then

Args.Compare := -1;

Else

Args.Compare := 1;

End If;

End Sub DimensionTree1OnCompareItems;

 

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

Var

Inst: IDimInstance;

Begin

Inst := UiDimension1.DimInstance;

AttrInst := Inst.Attributes.Item(1);

DimensionTree1.SortType := ControlSortType.Custom;

DimensionTree1.SortColumn := 1;

DimensionTree1.Sorted := True;

DimensionTree1.SortDefault;

End Sub Button1OnClick;

End Class TestForm;

After executing the example, on pressing the button, custom sorting by values of the second component column is executed. Values are sorted in descending order.

See also:

IDimensionViewerCompareEventArgs