VCL Delphi

function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
Result := -CompareText(Item1.Caption,Item2.Caption);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView1.CustomSort(@CustomSortProc, 0);
end;
II.yol:
var ColumnToSort: Integer;
procedure TForm1.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
begin
ColumnToSort := Column.Index;
(Sender as TCustomListView).AlphaSort;
end;
procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
var
ix: Integer;
begin
if ColumnToSort = 0 then
Compare := CompareText(Item1.Caption,Item2.Caption)
else begin
ix := ColumnToSort - 1;
Compare := CompareText(Item1.SubItems[ix],Item2.SubItems[ix]);
end;
end;
{-----------------------------------------------------------------------
Şükrü Kansız
GEBİTEK - Gelişmiş Bilişim Teknolojileri Tic. A.Ş
Bilgisayar Programcısı - Proje Koordinatörü
sukruk@gebitek.com / www.gebitek.com
Tel: +90(212) 225 84 77 Fax: +90(212) 225 84 76
-----------------------------------------------------------------------}