Ross Levis wrote:

Yip got that far, but how do I trigger it to go off and do a sort again
when I click on the header? That's where I am stuck now.


procedure TListViewForm.FileViewColumnClick(Sender: TObject; Column: TListColumn);
  function CustomSortProc(Item1, Item2: TListItem; OptionalParam: integer): integer; 
stdcall;
  begin
    Result := StrToInt(Item1.SubItems[0]) > StrToInt(Item2.SubItems[0])
    if ReverseSort then Result := -Result;
  end;
  ListView.CustomSort(@CustomSortProc, OptionalParam);
end;


do I have to repopulate the listview


No.


Thats pretty sweet.


I was about to suggest that I usually just do
onColumnClick
...  SortOrder := not SortOrder; ...

and in onCompare test the global SortOrder - as above (if SortOrder
then...)

But the above is my new way of doing it ;)

(and I think I was remembering incorrectly that a columnclick forced
a sort)

Cheers, Kurt.


---------------------------------------------------------------------------
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"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to