Sort column

The place for threads about version 1.x of TimoSoft ExplorerTreeView.
Post Reply
adhoc
Cadet
Posts: 2
Joined: 31 Jan 2008, 15:43

Sort column

Post by adhoc »

Hello,
I am using TreeView Control Version 1.13.2 and I want to sort (by name, by size, by date ....) the list of the file of the ListView on clicking the column header.
Is it possible? How can I do that?

Thanks
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

I'm not sure I understand your question right. You want to sort the items in the treeview by e. g. date, am I right?
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
adhoc
Cadet
Posts: 2
Joined: 31 Jan 2008, 15:43

Post by adhoc »

Yes.
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

There's a property SortingCriteria. Set it to the index of the column by which you want to sort. This index must be the same as the index that the namespace's IShellFolder2/IShellDetails implementation uses for the column.
Here are some default column indexes:
  • 0 - Name
  • 1 - File size
  • 2 - File type
  • 3 - Last changed on
The whole thing is not that useful, because the property is for the whole treeview and in different namespaces the same column index may identify different columns, e. g. "My Computer" doesn't have a "File size" column and uses column index 1 for the "Drive type" column I think. Also some namespaces don't support sorting in this way.
Another way might be to send a TVM_SORTCHILDRENCB message to the treeview and do the sorting all by yourself. This gives you full control, but requires more work and some understanding of how the shell works internally.

HTH
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply