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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. index of selected item in listctrl

index of selected item in listctrl

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabase
5 Posts 2 Posters 0 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.
  • D Offline
    D Offline
    danag
    wrote on last edited by
    #1

    How do i get the index of the selected item in list control?

    T 1 Reply Last reply
    0
    • D danag

      How do i get the index of the selected item in list control?

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      int itemIndex = m_lstFoo.GetNextItem(-1, LVNI_SELECTED); Tomasz Sowinski -- http://www.shooltz.com

      To some its a six-pack, to me it's a support group

      D 1 Reply Last reply
      0
      • T Tomasz Sowinski

        int itemIndex = m_lstFoo.GetNextItem(-1, LVNI_SELECTED); Tomasz Sowinski -- http://www.shooltz.com

        To some its a six-pack, to me it's a support group

        D Offline
        D Offline
        danag
        wrote on last edited by
        #3

        Thanks, I am able to get the index. I have 1 more Qs. I have written an message hanler for the list control for the message LVN_ENDLABELEDIT. After i edit the selected field , I want to put the newly typed data in it. So, i tried to use the listctrl.GetNextItem(); listctrl.GetItemText(); --- But this fucntion has the original text & not the new text and listctrl.SetItemText().

        T 1 Reply Last reply
        0
        • D danag

          Thanks, I am able to get the index. I have 1 more Qs. I have written an message hanler for the list control for the message LVN_ENDLABELEDIT. After i edit the selected field , I want to put the newly typed data in it. So, i tried to use the listctrl.GetNextItem(); listctrl.GetItemText(); --- But this fucntion has the original text & not the new text and listctrl.SetItemText().

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          All you need to set the item text in LVN_ENDLABELEDIT handler is to return TRUE. If you're using MFC, then you need to set *pResult to TRUE. Tomasz Sowinski -- http://www.shooltz.com

          To some its a six-pack, to me it's a support group

          D 1 Reply Last reply
          0
          • T Tomasz Sowinski

            All you need to set the item text in LVN_ENDLABELEDIT handler is to return TRUE. If you're using MFC, then you need to set *pResult to TRUE. Tomasz Sowinski -- http://www.shooltz.com

            To some its a six-pack, to me it's a support group

            D Offline
            D Offline
            danag
            wrote on last edited by
            #5

            THANKS. I GOT IT.

            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