Board index » delphi » TLIST - MyList.Sort(Compare: TListSortcompare);
Rakamsingh Limbu Begha
![]() Delphi Developer |
Sun, 09 Nov 2003 13:37:52 GMT
TLIST - MyList.Sort(Compare: TListSortcompare);
Dear Sirs,
I have appended my Listing below. I looked as to how TList.Sort (Compare: With out examples I am still confused how and what parameters should be I would be most grateful if you could give any help. Faithfully, PMyList = ^PwdRecord; PwdRecord = record cLogInID: String[4]; cGroup: String[8]; cPwd : String[8]; PwdDate: TDateTime; cUser: String[4]; end; var i:Integer; MyList: TList; ARecord: PMyList; //UserLogInIDFile: Array of PwdRecord; //This only example here. begin i := 0; MyList := TList.Create; try for i := 0 to High(UserLogInIDFile) do begin New(ARecord); ARecord^.cLogInID := UserLogInIDFile[i].cLogInID; ARecord^.cGroup := UserLogInIDFile[i].cGroup; ARecord^.cPwd := UserLogInIDFile[i].cPwd; ARecord^.PwdDate := UserLogInIDFile[i].PwdDate; ARecord^.cUser := UserLogInIDFile[i].cUser; MyList.Add(ARecord); end; //MyList.Sort(Compare: TListSortcompare); // This is what //the helpline says but without example. MyList.Sort(?? What parameters?) for i := 0 to (MyList.Count - 1) do begin ARecord := MyList.Items[i]; Dispose(ARecord); end; Finally MyList.Free; end; end; |