How to sort data as I want in VirtualExplorerTreeview (VirtualShellTools)

This is probably a very "dumb" question for those who know VirtualShellTools, but I just started using it and could not find my answer in the demo code. Please note that I am also not familiar with virtualtreeview.

I am using VirtualExplorerTreeview to display the directory structure associated with VirtualExplorerListview to display a specific type of files in a selected directory as well as specific information about them

I was able to point them in the right place, bind them the way I wanted, filter everything in the list, and look at demos, I have a pretty good idea on how to add my own columns and draw them to display my custom data.

My problem is with the Treeview: I would like to sort the directories displayed in the order I want; in particular, I want to first specify "My Documents" and another folder, then drives, and then removable media. Looking at the TNamespace property I found how to distinguish them (Directory and Removable properties), but I don't know how to implement my own view / what event I need. I tried CompareNode but it doesn't even seem like a call.

0


a source to share


1 answer


If you want to do everything yourself, set toUserSort

in the property TVirtualExplorerTree.TreeOptions.VETMiscOptions

. This forces the control to simply use a method DoCompare

inherited from the virtual tree view and which should call the event handler OnCompareNodes

.

The best way is to create a custom one TShellSortHelper

. Descend this class and override any methods you need. Create an instance of this class and assign the tree property to it SortHelper

. (The tree takes on the role of helper, frees the old one, but not the new one). If the items are sorted by a column that this class doesn't know how to compare, then handle the tree event OnCustomColumnCompare

.



To help you determine which methods you need to override, or the events you need to handle, set a breakpoint at TCustomVirtualExplorerTree.DoCompare

and navigate to it to see what gets called in different situations.

+3


a source







All Articles