List view date sort 
Author Message
 List view date sort

Doing a sort on a list view in vb6 with common controls 6, using the winapi
call as per the KB article on how to do it using sendmessage and
lvm_sortlistitems(?), only trouble is we're using colour coding of entries
in the list view so the text is sorted but not the colour. Does anyone know
how to get around this, I've looked at the lvwitem structure but theres no
colour property, I cant get an HDC on the list items as far as I'm aware. If
I could either get to change the colour directly or get a mapping between
the old and new index of list items that would be fine
.
Any clues? Thanks in advance

--
Regards
Rob Thomson
0181 690 7030



Mon, 14 Oct 2002 03:00:00 GMT  
 List view date sort
Go back to the basics:  maintain a hidden
ColumnHeader object with a text-sortable version
of your data.  On the ColumnHeaders_Click event,
set the Sort property to your hidden column.  Will
that do the trick?

JHK



Quote:
> Doing a sort on a list view in vb6 with common

controls 6, using the winapi
Quote:
> call as per the KB article on how to do it using
sendmessage and
> lvm_sortlistitems(?), only trouble is we're

using colour coding of entries
Quote:
> in the list view so the text is sorted but not

the colour. Does anyone know
Quote:
> how to get around this, I've looked at the

lvwitem structure but theres no
Quote:
> colour property, I cant get an HDC on the list

items as far as I'm aware. If
Quote:
> I could either get to change the colour directly

or get a mapping between
Quote:
> the old and new index of list items that would
be fine
> .
> Any clues? Thanks in advance

> --
> Regards
> Rob Thomson
> 0181 690 7030



Mon, 14 Oct 2002 03:00:00 GMT  
 List view date sort
Try http://www.mvps.org/vbnet/code/callback/lvsortcallback.htm

--
Randy Birch, MVP Visual Basic

http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Please correspond only using the newsgroups so all can benefit.


| Doing a sort on a list view in vb6 with common controls 6, using the
winapi
| call as per the KB article on how to do it using sendmessage and
| lvm_sortlistitems(?), only trouble is we're using colour coding of entries
| in the list view so the text is sorted but not the colour. Does anyone
know
| how to get around this, I've looked at the lvwitem structure but theres no
| colour property, I cant get an HDC on the list items as far as I'm aware.
If
| I could either get to change the colour directly or get a mapping between
| the old and new index of list items that would be fine
| .
| Any clues? Thanks in advance
|
| --
| Regards
| Rob Thomson
| 0181 690 7030
|
|



Mon, 14 Oct 2002 03:00:00 GMT  
 List view date sort
Thanks for your help people, as luck would have it someone picked up some
code from a site called I think
www.sourcecode.com (?) to fix this. The fix is to convert dates and numbers
into a string sortable format, ie
9 and 100 are set to 009 and 100 and dates converted into longs and the same
approach taken. The original data is stored in the tag of the listitem with
a chr(0) separator, then the sort is performed and the data put back.
Performance seems fine on over 200 items.

We chose not to use the hidden columns as the listviews were configurable
for user preferences at start up, and during a session, so a hidden column
would cause extra work in a number of screens.

Thanks for the api calls to retrieve the item position, I had been
struggling with this for some hours and had to leave it

The thing that I'm still left wondering how to do is to copy the format
over. If I have coloured item one, sort via the api and it now becomes
number 10, the first item in the list still has the same colour as number
one

Whilst I can get the text from the list item what I cant do is to recolour
the list item in its original format

The lvw_item structure does not appear to support colour, any idea as to how
to do this?

Quote:
> Try http://www.mvps.org/vbnet/code/callback/lvsortcallback.htm

> --
> Randy Birch, MVP Visual Basic

> http://www.mvps.org/vbnet/
> http://www.mvps.org/ccrp/

> Please correspond only using the newsgroups so all can benefit.



> | Doing a sort on a list view in vb6 with common controls 6, using the
> winapi
> | call as per the KB article on how to do it using sendmessage and
> | lvm_sortlistitems(?), only trouble is we're using colour coding of
entries
> | in the list view so the text is sorted but not the colour. Does anyone
> know
> | how to get around this, I've looked at the lvwitem structure but theres
no
> | colour property, I cant get an HDC on the list items as far as I'm
aware.
> If
> | I could either get to change the colour directly or get a mapping
between
> | the old and new index of list items that would be fine
> | .
> | Any clues? Thanks in advance
> |
> | --
> | Regards
> | Rob Thomson
> | 0181 690 7030
> |
> |



Mon, 14 Oct 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Logical sorting in List View (date and/or time)

2. List View click on header to sort date column

3. Sorting List View Control on date field??

4. Sorting List View Control on date field??

5. slow list view sorting - help needed

6. Sorting the content of list view on clicking column headers

7. List view and sorting

8. List View Sort Question

9. List View Sort order

10. List View Column Sorting

11. list view to sort

12. List View - Sort by Clicking Header

 

 
Powered by phpBB® Forum Software