1. Technology

Add Custom Sorting To Delphi's TShellListView Control


1 of 4

TShellListView - No OnCompare For Custom Sort :(
TShellListView Custom Sorting

TShellListView Custom Sorting

The TShellListView control (a part of the Shell Controls package) can be used to display files from the file system. Paired with TShellTreeView shell, the TShellListView can be used to mimic Windows Explorer user interface.

By design, the TShellListView sorts files (and folders) ascending by their name. There's no "OnCompare" event you can handle to change the sort order or the column (name, type, date modified, size) used for sorting.

What we are up to in this article, is adding a popup menu to the TShellListView control that would allow users of your Delphi application to sort files displayed by the shell list view: ascending or descending, by name, size, date modified or type.

The picture displays our final goal.

  1. About.com
  2. Technology
  3. Delphi
  4. Using VCL Components
  5. Shell List View Sorting - Add Sorting To Delphi's TShellListView Control

©2014 About.com. All rights reserved.