k4hvd77
asked on
Sorting TListView
Hello, I would sort a TListView by Clicking on the column (containes DateTime). Could You help me there?
Of course a better way to get the column is to use an OnColumnClick event.
procedure TForm1.ListView1ColumnClic k(Sender: TObject;
Column: TListColumn);
begin
end;
procedure TForm1.ListView1ColumnClic
Column: TListColumn);
begin
end;
ASKER
but How can I sort it?
Do you want to sort by Caption, Data or Both?
ASKER
I would sort by caption (Caption contains TDateTime)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Exact that what I want :)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
StatusBar1: TStatusBar;
procedure ListView1MouseMove(Sender:
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ListView1MouseMove(
Y: Integer);
begin
StatusBar1.Panels[0].Text := IntToStr(x);
StatusBar1.Panels[1].Text := IntToStr(y);
IF (X > ListView1.Columns[0].Width
THEN StatusBar1.Panels[2].Text := 'Column 2'
ELSE StatusBar1.Panels[2].Text := 'Column 1';
end;
end.