Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. List Control column Sort Problem

List Control column Sort Problem

Scheduled Pinned Locked Moved C / C++ / MFC
algorithmshelpquestion
4 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BiswaR
    wrote on last edited by
    #1

    Hello Guys, I have list control on a dialog box. When i click a header(column name) of the list control it should be sorted(ascending or descending) autimatically. Is there any property to set this or i need to write this sorting logic itself ? Please reply soon if you guys know this it's urgent. Thanks! -- modified at 4:06 Tuesday 11th April, 2006

    H stefanmihaimogaS R 3 Replies Last reply
    0
    • B BiswaR

      Hello Guys, I have list control on a dialog box. When i click a header(column name) of the list control it should be sorted(ascending or descending) autimatically. Is there any property to set this or i need to write this sorting logic itself ? Please reply soon if you guys know this it's urgent. Thanks! -- modified at 4:06 Tuesday 11th April, 2006

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Hi BiswaR, Im't not sure but maybe it is some helpful to you http://www.codeproject.com/listctrl/ReportControl.asp[^]

      1 Reply Last reply
      0
      • B BiswaR

        Hello Guys, I have list control on a dialog box. When i click a header(column name) of the list control it should be sorted(ascending or descending) autimatically. Is there any property to set this or i need to write this sorting logic itself ? Please reply soon if you guys know this it's urgent. Thanks! -- modified at 4:06 Tuesday 11th April, 2006

        stefanmihaimogaS Offline
        stefanmihaimogaS Offline
        stefanmihaimoga
        wrote on last edited by
        #3

        I think you should overwrite the HDN_ITEMCLICK default routine from CListCtrl; that will give you the header item selected in LPNMHEADER phdr = reinterpret_cast(pNMHDR); m_nSortHeaderItem = phdr->iItem; After that you do the 'sort' thing and display the new list. This is how I did it! Good luck and keep the good coding!

        1 Reply Last reply
        0
        • B BiswaR

          Hello Guys, I have list control on a dialog box. When i click a header(column name) of the list control it should be sorted(ascending or descending) autimatically. Is there any property to set this or i need to write this sorting logic itself ? Please reply soon if you guys know this it's urgent. Thanks! -- modified at 4:06 Tuesday 11th April, 2006

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          The List Control doesn't have any styles for doing this automatically, but you can handle the HDN_ITEMCLICK notifications and use SortItems() on the list control.

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups