Author: Tomas Rutkauskas
I have an integer value as ListItem caption (using InttoStr). I would like to sort
according to the Integer value of these captions. Any Ideas?
Answer:
1 2 function Cussort(Item1, Item2: TListItem; lParamSort: Integer): Integer; stdcall;
3 var4 I1, I2: Integer;
5 begin6 I1 := StrToIntDef(Item1.Caption, -1);
7 I2 := StrToIntDef(Item2.Caption, -1);
8 if I1 > I2 then9 Result := 1
10 elseif I2 < I1 then11 Result := -1
12 else13 Result := 0;
14 end;
15 16 MyListView.CustomSort(@Cussort, 0);