SortListView
v1.00
© 2007, Priyatna
Bandung - Indonesia
http://www.priyatna.org/
mailto:me@priyatna.org
Introduction
History
License
Installation
Methods
Properties
Contacts
Version: 1.01
Release Date: June 5th, 2007
Introduction
SortListView is a standrad TListView descendant with sorting capability. It shows a little arrow in the currently sorted column. Clicking on this arrow will toggle ascending and descending order. You can use an event handler to perform a custom sort.
Being simple and straight forward, you can easily convert your standard listview to this component without modifying a single code, using text replacement tool or IDE expert.
Version History
Version 1.01 - June 5th, 2007
Bug fix when no SmallImages assigned to listview. Thanks to Bruce Christensen
(twsocket.shaw.ca).
Version 1.00 - May 26th, 2007
Initial release
License
This library is released under Mozilla Public License. You can use it in your freeware, shareware or commercial softwares. You can send your modification to me, and if I decide to include it in the main distribution, I will add your name as a contributor. You can read full licensing information here.
Installation
There is no special process to install it on Delphi. Just open SortListViewD7.dpk on Delphi IDE and press Install button. I use Delphi 7. If you use another Delphi version, you may have to make some minor changes.
The component will appear in priyatna.org tab.
Properties
There are some main properties of the component:
// sorting simple string. This is actually the default behavior of the component,
// so you don't need to do this. I just want to show you how to fill Res value. procedure TForm1.SortListView1CustomSort(Sender: TObject; ColIndex: Integer; Str1, Str2: string; var Res: Integer; var Handled: Boolean); begin Res := CompareText(Str1, Str2); Handled := True; end; // sorting numbers procedure TForm1.SortListView1CustomSort(Sender: TObject; ColIndex: Integer; Str1, Str2: string; var Res: Integer; var Handled: Boolean); var n1, n2: Integer; begin // for example, third column contains numbers if (ColIndex = 2) then begin n1 := StrToIntDef(Str1, 0); n2 := StrToIntDef(Str2, 0); if (n1 = n2) then Res := 0 else if (n1 > n2) then Res := 1 else Res := -1; Handled := True; end; end;
Contacts
Don't hesitate to report any bug or whish to me:
Priyatna
Bandung - Indonesia
http://www.priyatna.org/
mailto:me@priyatna.org