Board index » delphi » Having problems with sort method in tlist, cant declare compare function
Michael Donovan
![]() Delphi Developer |
Sat, 18 Aug 2001 03:00:00 GMT
Having problems with sort method in tlist, cant declare compare function
I am having problems using the sort method for a tlist.
The code below won't compile I get the My parameters for the swap items must be of type tptdata. Any help would be brilliant, Thanks ---------------------------- interface uses type tPtData = ^fPtData; TForm1 = class(TForm) PtData: tPtData; public var implementation {$R *.DFM} function SortFun(Item1, Item2: tPtData): Integer; if (tPtData(Item1)^.pos < tPtData(Item2)^.pos) then Result := 0 end; procedure TForm1.FormCreate(Sender: TObject); begin ControlList := tList.Create; //fill list with 100 random int's for i := 0 to 99 do //sort list ControlList.Sort(SortFun); //clean up list for i := 0 to ControlList.Count - 1 do ControlList.CLear; ControlList.Free; end. -- ------------------------------------------------ |