I'm trying to do a custom sort on a TStringList and i'm geting a error:
function TFrmTimer.CompareFloat(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := StrToInt(List[Index1]) - StrToInt(List[Index2]);
end;
procedure TFrmTimer.Button5Click(Sender: TObject);
var
Str: TStringList;
i, int: integer;
begin
Randomize;
Str := TStringList.Create;
for i := 1 to 10 do
begin
Str.Add(IntToStr(Random(100)));
end;
Memo1.lines.Clear;
Memo1.Lines.add(intToStr(Str.Count));
Memo1.lines := Str;
Str.CustomSort(@CompareFloat);
Memo1.Lines.add('sorted-------------------');
Memo1.lines := Str;
Str.Free;
end;
But I'm getting a error that I don't understand:
main.pas(374,32) Error: Incompatible type for arg no. 1: Got "<procedure variable type of function(TStringList;LongInt;LongInt):LongInt of object;Register>", expected "<procedure variable type of function(TStringList;LongInt;LongInt):LongInt;Register>"