unit LVT;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;
type
TForm1 =
class(TForm)
ListView1: TListView;
procedure FormCreate(Sender: TObject);
procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
private
procedure DatensaetzeHinzufuegen ;
function CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer;
stdcall;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.CustomSortProc(Item1, Item2: TListItem;
ParamSort: integer): integer;
begin
Result := -CompareText(Item1.Caption, item2.Caption);
end;
{*
Testdaten
*}
procedure TForm1.DatensaetzeHinzufuegen;
var
Litem : TListItem;
begin
ListView1.Items.BeginUpdate;
ListView1.Items.Clear;
.
.
.
ListView1.Items.EndUpdate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DatensaetzeHinzufuegen;
end;
procedure TForm1.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
begin
ListView1.CustomSort(@CustomSortProc, 0);
end;
end.