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. How to change the index of Header Item?

How to change the index of Header Item?

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestion
6 Posts 3 Posters 1 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.
  • M Offline
    M Offline
    mikert_2008
    wrote on last edited by
    #1

    Hi, I want to change the index of header Item on drag drop. If header item 0 drag drop to next header column(After HeaderCol 1) then change the index of Header item 0 to 1. & Header Item 1 index to 0. I am using GetItem() & SetItem() but that's not working. How to do this? Please make the correction in the code:- On DragDropFunc() { HDITEM pHeaderItemCurrent,pHeaderItemNew; TCHAR lpBuffer[256]; TCHAR lpBuffer1[256]; pHeaderItemCurrent.pszText = lpBuffer; pHeaderItemCurrent.cchTextMax = 256; pHeaderItemNew.pszText = lpBuffer1; pHeaderItemNew.cchTextMax = 256; m_HeaderCtrl.GetItem(0,&pHeaderItemCurrent); m_HeaderCtrl.GetItem(1,&pHeaderItemNew); m_HeaderCtrl.SetItem(0, &pHeaderItemNew); m_HeaderCtrl.SetItem(1, &pHeaderItemCurrent); } Thanks:- Mike

    _ 1 Reply Last reply
    0
    • M mikert_2008

      Hi, I want to change the index of header Item on drag drop. If header item 0 drag drop to next header column(After HeaderCol 1) then change the index of Header item 0 to 1. & Header Item 1 index to 0. I am using GetItem() & SetItem() but that's not working. How to do this? Please make the correction in the code:- On DragDropFunc() { HDITEM pHeaderItemCurrent,pHeaderItemNew; TCHAR lpBuffer[256]; TCHAR lpBuffer1[256]; pHeaderItemCurrent.pszText = lpBuffer; pHeaderItemCurrent.cchTextMax = 256; pHeaderItemNew.pszText = lpBuffer1; pHeaderItemNew.cchTextMax = 256; m_HeaderCtrl.GetItem(0,&pHeaderItemCurrent); m_HeaderCtrl.GetItem(1,&pHeaderItemNew); m_HeaderCtrl.SetItem(0, &pHeaderItemNew); m_HeaderCtrl.SetItem(1, &pHeaderItemCurrent); } Thanks:- Mike

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      Are you in search of this ? m_mylistcontrol.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      M 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        Are you in search of this ? m_mylistcontrol.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        M Offline
        M Offline
        mikert_2008
        wrote on last edited by
        #3

        NO. I have already added the HDS_DRAGDROP while creating the header control. What I need is to change the header Id which we specify while insertion. i.e m_header.InsertItem(columnId, &hditem);//columnId =1; Now How Can assign the some different hditem to columnId = 1; I try with SetItem() as in code but its not working...... Any suggestion. Mike

        _ 1 Reply Last reply
        0
        • M mikert_2008

          NO. I have already added the HDS_DRAGDROP while creating the header control. What I need is to change the header Id which we specify while insertion. i.e m_header.InsertItem(columnId, &hditem);//columnId =1; Now How Can assign the some different hditem to columnId = 1; I try with SetItem() as in code but its not working...... Any suggestion. Mike

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          Just one quick question. Why do you want to change the index of the item?

          You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

          M 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            Just one quick question. Why do you want to change the index of the item?

            You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

            M Offline
            M Offline
            mikert_2008
            wrote on last edited by
            #5

            Yes. I need to change the index of item. The new index will be postion of column after drag drop. Mike.

            R 1 Reply Last reply
            0
            • M mikert_2008

              Yes. I need to change the index of item. The new index will be postion of column after drag drop. Mike.

              R Offline
              R Offline
              Rolf Kristensen
              wrote on last edited by
              #6

              Check out CHeaderCtrl::SetItem() and HDI_ORDER

              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