Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to use sort method of TList

Posted on 2001-08-14
1
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 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