Board index » delphi » TListview sort routine

TListview sort routine

Anyone have a somewhat generic sort routine for TListviews.

I'm looking to be able to click on a column header and it sort by that column. It should hold the last sort... If one column is City and one column is State and the user clicks on city then clicks on state, two items with Houston and TX as the contents should be next to each other. I already got code that will do it, but I'm curious how others have solved this problem.

thanks,
Ben

 

Re:TListview sort routine


Quote
> I'm looking to be able to click on a column header and it sort by that

column. It should hold the last sort... If one column is City and one column
is State and the user clicks on city then clicks on state, two items with
Houston and TX as the contents should be next to each other. I already got
code that will do it, but I'm curious how others have solved this problem.
Quote

I advice to use TVirtualStringTree (www.lischke-online.de). It has a sorting
approach like TStringlist.Sort, where you have to give
a function returning a integer value as comparison result of two items.  I
just used it recently and it worked fine.

Other Threads