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 get the selectedColumn in a CListCtrl.

How to get the selectedColumn in a CListCtrl.

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
9 Posts 4 Posters 5 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.
  • F Offline
    F Offline
    FISH786
    wrote on last edited by
    #1

    i have a report style CListCtrl. How do i retrieve the text from the individual cell. Actually I have been able to get the selected row but seem to be having problems trying to get the row,column combination. this gives me the row: int nSelected = m_handselection.GetNextSelectedItem(x); I have searched and might have either overlooked or could not find anything to give me the column.

    _ R 2 Replies Last reply
    0
    • F FISH786

      i have a report style CListCtrl. How do i retrieve the text from the individual cell. Actually I have been able to get the selected row but seem to be having problems trying to get the row,column combination. this gives me the row: int nSelected = m_handselection.GetNextSelectedItem(x); I have searched and might have either overlooked or could not find anything to give me the column.

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

      GetItemText[^]

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

      F 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        GetItemText[^]

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

        F Offline
        F Offline
        FISH786
        wrote on last edited by
        #3

        Yes. CString GetItemText( int nItem, int nSubItem ) I can get the the nItem which is the row i have clicked. How do I get the nSubItem?

        _ S 2 Replies Last reply
        0
        • F FISH786

          Yes. CString GetItemText( int nItem, int nSubItem ) I can get the the nItem which is the row i have clicked. How do I get the nSubItem?

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

          FISH786 wrote:

          CString GetItemText( int nItem, int nSubItem )

          CString GetItemText( int nItem, int nSubItem ) Did you see the definition. Don't you spot the return value from the function. Spoonfeeding Uhh!

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

          F 1 Reply Last reply
          0
          • F FISH786

            Yes. CString GetItemText( int nItem, int nSubItem ) I can get the the nItem which is the row i have clicked. How do I get the nSubItem?

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            nSubItem == column

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            F 1 Reply Last reply
            0
            • _ _AnsHUMAN_

              FISH786 wrote:

              CString GetItemText( int nItem, int nSubItem )

              CString GetItemText( int nItem, int nSubItem ) Did you see the definition. Don't you spot the return value from the function. Spoonfeeding Uhh!

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

              F Offline
              F Offline
              FISH786
              wrote on last edited by
              #6

              Not. really. I did get the row, but can't get the column. I used nItem = m_myListCtrl.GetNextSelectedItem(pos); but could not find anything simmilar to GetNextSelectedItem() to get the Column. Like I said I don't know and could not find what to use to get the column. Was asking for help only. Thanks In advance.

              1 Reply Last reply
              0
              • S Stuart Dootson

                nSubItem == column

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                F Offline
                F Offline
                FISH786
                wrote on last edited by
                #7

                thanks. I realized that but am having a hard time or have missed something to get the column. I know I have the right row, since when i use the getItemtext with the nItem, and hadcoded "0", I get the first column values. But once again I am having a difficult time to change that "0" to the selected column or clicked column cell.

                S 1 Reply Last reply
                0
                • F FISH786

                  thanks. I realized that but am having a hard time or have missed something to get the column. I know I have the right row, since when i use the getItemtext with the nItem, and hadcoded "0", I get the first column values. But once again I am having a difficult time to change that "0" to the selected column or clicked column cell.

                  S Offline
                  S Offline
                  Stuart Dootson
                  wrote on last edited by
                  #8

                  Ah - you want the sub-item that the user clicked on! The selection model for lists only includes selected rows, not columns. This means that what you need to do is handle the NM_CLICK notification[^] for the list view. This notification contains a pointer to an NMITEMACTIVATE structure[^] which contains details of where the click occurred, including the sub-item. You can then store that sub-item as the 'last-clicked sub-item'?

                  Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                  1 Reply Last reply
                  0
                  • F FISH786

                    i have a report style CListCtrl. How do i retrieve the text from the individual cell. Actually I have been able to get the selected row but seem to be having problems trying to get the row,column combination. this gives me the row: int nSelected = m_handselection.GetNextSelectedItem(x); I have searched and might have either overlooked or could not find anything to give me the column.

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

                    You have to maintain what column was clicked by the user. See handle mouse-events and keyboard-events: CListCtrl and Cell Navigation[^]

                    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