Ver Mensaje Individual
  #4  
Antiguo 18-09-2006
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.112
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

Pues sí, revisando la ayuda (que no se me ocurrió antes, la verdad) se ve que "TList" cuenta con un método "Sort" que puede ayudarte. Hay un ejemplo y todo...
Cita:
The following code sorts the objects in a list in alphabetical order based on their names. It assumes that the list contains only component references.

The CompareNames function performs the comparisons between objects in the list. The list is sorted when the user clicks a button.

Código Delphi [-]
function CompareNames(Item1, Item2: Pointer): Integer;
begin
  Result := CompareText((Item1 as TComponent).Name, (Item2 as TComponent).Name);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  List1.Sort(@CompareText);
end;
__________________
David Esperalta
www.decsoftutils.com
Responder Con Cita