?
Solved

How to use sort method of TList

Posted on 2001-08-14
1
Medium Priority
?
175 Views
Last Modified: 2010-04-06
Hi,
I declared the following type :
type
  TSeg = Record
             Starts, Ends: integer;
           Type1, type2: tring;
         end;

var  PSeg : ^TSeg;
     slSeg : TList;  
I add PSeg into a slSeg. How can I sort the data in the slSeg depending on Starts or Ends?

PeterShaw
0
Comment
Question by:petershaw8
1 Comment
 
LVL 4

Accepted Solution

by:
fva earned 200 total points
ID: 6383698
Example sort by Starts:

function MyStartsCompare(Item1,Item2:Pointer):integer;
begin
     if PSeg(Item1)^.Starts=PSeg(Item2)^.Starts then Result:=0
     else if PSeg(Item1)^.Starts<PSeg(Item2)^.Starts then Result:=-1
     else Result:=1;
end;

procedure DoSortOnStarts;
begin
     slSeg.Sort(MyStartsCompare);
end;

For Ends you'll figure it out :)

F.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 22 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question