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. CListCtrl

CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 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.
  • H Offline
    H Offline
    Halawlaws
    wrote on last edited by
    #1

    I have a ClistCtrl with three columns how do i select wich colum i want to insert my string. Each time i insert a String it is inserted in the same column (1): int a; a = m_F.m_SN.GetCount()-1; while (a>0) { S = m_F.m_SN.GetAt(m_F.m_SN.FindIndex(a)); CLC.InsertItem(a,S.SNUPS,0); CLC.InsertItem(a,S.SNRand,1); CLC.InsertItem(a,S.SNDevice,2); a--; } /\|-||\/|/\|)

    M B 2 Replies Last reply
    0
    • H Halawlaws

      I have a ClistCtrl with three columns how do i select wich colum i want to insert my string. Each time i insert a String it is inserted in the same column (1): int a; a = m_F.m_SN.GetCount()-1; while (a>0) { S = m_F.m_SN.GetAt(m_F.m_SN.FindIndex(a)); CLC.InsertItem(a,S.SNUPS,0); CLC.InsertItem(a,S.SNRand,1); CLC.InsertItem(a,S.SNDevice,2); a--; } /\|-||\/|/\|)

      M Offline
      M Offline
      Marc Soleda
      wrote on last edited by
      #2

      You have to fill the LVITEM structure: LVITEM lvi; CString csText = "Hi !!"; lvi.iItem = 0; //row lvi.iSubItem = 1; // column lvi.mask = LVIF_TEXT; // for only text. lvi.pszText = csText.GetBuffer(0); CLC.InsertItem(&lvi); For a complete guide Using the List Control [^] I hope it helps, Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

      H 1 Reply Last reply
      0
      • H Halawlaws

        I have a ClistCtrl with three columns how do i select wich colum i want to insert my string. Each time i insert a String it is inserted in the same column (1): int a; a = m_F.m_SN.GetCount()-1; while (a>0) { S = m_F.m_SN.GetAt(m_F.m_SN.FindIndex(a)); CLC.InsertItem(a,S.SNUPS,0); CLC.InsertItem(a,S.SNRand,1); CLC.InsertItem(a,S.SNDevice,2); a--; } /\|-||\/|/\|)

        B Offline
        B Offline
        BadKarma
        wrote on last edited by
        #3

        Hi, InsertItem, adds an item to the listcontrol, this is a full line in the list view and is in fact the text of the first column. The text in the other columns (2 and further) is call subitems. int nIndex = 1; nIndex = c_listcontrol.InsertItem(nIndex, "placed in first column"); // use the new index because we dont know where the actual item is added in the listview, // due to sorting and so. // add to second column, 1: subindex is zero based c_listcontrol.SetItemText(nIndex, 1, "placed in second column"); // add to third column, 2: c_listcontrol.SetItemText(nIndex, 2, "placed in third column"); Regards Kurt Pattyn codito ergo sum

        H 1 Reply Last reply
        0
        • B BadKarma

          Hi, InsertItem, adds an item to the listcontrol, this is a full line in the list view and is in fact the text of the first column. The text in the other columns (2 and further) is call subitems. int nIndex = 1; nIndex = c_listcontrol.InsertItem(nIndex, "placed in first column"); // use the new index because we dont know where the actual item is added in the listview, // due to sorting and so. // add to second column, 1: subindex is zero based c_listcontrol.SetItemText(nIndex, 1, "placed in second column"); // add to third column, 2: c_listcontrol.SetItemText(nIndex, 2, "placed in third column"); Regards Kurt Pattyn codito ergo sum

          H Offline
          H Offline
          Halawlaws
          wrote on last edited by
          #4

          thx man /\|-||\/|/\|)

          1 Reply Last reply
          0
          • M Marc Soleda

            You have to fill the LVITEM structure: LVITEM lvi; CString csText = "Hi !!"; lvi.iItem = 0; //row lvi.iSubItem = 1; // column lvi.mask = LVIF_TEXT; // for only text. lvi.pszText = csText.GetBuffer(0); CLC.InsertItem(&lvi); For a complete guide Using the List Control [^] I hope it helps, Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.

            H Offline
            H Offline
            Halawlaws
            wrote on last edited by
            #5

            thx man /\|-||\/|/\|)

            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