-
Oct 16th, 2020, 09:04 PM
#1
LVS_OWNERDATA and sorting
Has anyone ever implemented a sorting routine for virtual ListViews? Figured I'd ask before I went crazy reinventing the wheel; basic search didn't turn up anything. Trying to convert my shell browser to virtual mode... should be, well, interesting.
-
Oct 16th, 2020, 10:24 PM
#2
Re: LVS_OWNERDATA and sorting
It's just a question of sorting your backing data.
I normally use an ADO Recordset to hold the data, which makes sorting pretty easy.
See: https://www.vbforums.com/showthread....=1#post4827625
-
Oct 16th, 2020, 10:30 PM
#3
Re: LVS_OWNERDATA and sorting
I realize you probably aren't using a query rowset as backing storage, but you can always use a fabricated Recordset. No database is needed for ADO Recordsets.
-
Oct 17th, 2020, 04:46 PM
#4
Addicted Member
Re: LVS_OWNERDATA and sorting
The point about LVS_OWNERDATA is that you are absolutely free in the choice of how you manage your data. The control really doesn't care what you use for sorting - as discussed, btw, here in May 2018
So pick a fast routine, from a C dll for example. I have a 100,000 records database from the post by dilettante mentioned above, it gets sorted in about 60-80ms on my trusty old Core i5. Excel needs more than a second, OpenOffice is another factor 10 slower. I've heard that Python offers really fast string sorts, maybe that's worth a test - if speed matters at all for you.
-
Oct 19th, 2020, 05:47 AM
#5
Re: LVS_OWNERDATA and sorting
The only project where I use virtual listview & sort, the data is not recordset-bound. In my case, the items are initially sorted when read from unsorted source. As suggested, use a fast sorting routine as needed or use sorted indexes. If recordset-bound, already suggested to use its sorting functions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|