Sorting...

This is a discussion on Sorting... within the Windows Programming forums, part of the Platform Specific Boards category; After I created a listview control, and placed all I need in side, how can I reverse the order of ...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Sorting...

    After I created a listview control, and placed all I need in side, how can I reverse the order of the content?
    Is there a special message I could send to it?

    Thanks
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Just send the LB_PLEASE_SWAP_SORT_ORDER message.

    Honestly though, you have to either sort your strings manually, send LB_RESETCONTENT to clear the box, and then send the strings again in the order you want, which - BTW - is a straightforward matter, OR you can reset the content, resend the strings unsorted, and then mess with the WM_COMPAREITEM message, which == big headache.

    Choose your weapon.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    You could use a combination of ListView_GetItem() and ListView_SetItem(). The iItem member of the LVITEM structure refers to the index of the item within the list view.

    With this in mind, you'd iterate through all items, obtain each item's LVITEM structure, manipulate the index, and upload the modified structure to the list view.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  4. #4
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    thank you
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting algorithms, worst-case input
    By Leftos in forum C++ Programming
    Replies: 17
    Last Post: 06-15-2009, 01:33 PM
  2. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  3. sorting structure members using pointers
    By robstr12 in forum C Programming
    Replies: 5
    Last Post: 07-25-2005, 05:50 PM
  4. Still Needing Help : selection sorting
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 10-14-2001, 08:41 PM
  5. selection sorting
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 10-13-2001, 08:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21