J

Looking at it I don't think you can directly - tho the TCollection
implements the
management of the of the Items in a TList (which can be sorted) this is
private (and therefore inaccessable)

but you can do

var
  i : integer;
  SortList: TList;
  CollItem : TCollItem;

  with SortList.Create do
  try
    for i := 0 to Coll.Count-1 do
      SortList.Add(Coll[i]); // make a temp list
    SortList.Sort(SortFunction) // sort the temp list
    for i := 0 to SortList.Count-1 do // apply updates to coll
    begin
       CollItem  :=  CollI.FindItem(TCollItem(SortList[i]).ID)
       CollItem.SetIndex(i);
    end;
  finally
    free
  end




----- Original Message -----
From: <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Friday, 22 September 2000 03:10
Subject: [DUG]: Sorting a Collection


> HI all.
>
> how does one got about sorting a Collection ?
> I want to do it based on a Numberic value.
>
>
> Cheers, Jeremy Coulter
>
>
>
> Jeremy Coulter (Manager)
> Visual Software Solutions
> Christchurch, New Zealand
> PH 03-3521595
> FAX 03-3521596
> MOBILE 021-2533214
> www.vss.co.nz
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to