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. listview problem

listview problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpwpfcomtoolsquestion
3 Posts 2 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.
  • A Offline
    A Offline
    Amit Dey
    wrote on last edited by
    #1

    Hello all, I'm using a CListView class in report mode,in my splitter window.When I'm trying to insert items, I see that although I can add the first item data, I cannot see other items(i.e. I can see Hello and the World column, but no entry under it. Help?? //Precreate window - //cs.style |= LVS_REPORT|LVS_SORTASCENDING; //set list styles //then InsertColumn(0,IDS_HELLO); InsertColumn(1,IDS_WORLD); CString szHello("Hello"); CString szWorld("World"); CListCtrl& list = GetListCtrl(); ZeroMemory((void*) &Item, sizeof(Item)); Item.mask = LVIF_TEXT; Item.iItem = 0; Item.iSubItem = 0; Item.pszText = (LPTSTR)(LPCTSTR)szSubject; list.InsertItem(&Item); list.SetItemText(0,1,(LPTSTR)(LPCTSTR)szWorld);

    Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
    PocketPC New menu Office addin

    M 1 Reply Last reply
    0
    • A Amit Dey

      Hello all, I'm using a CListView class in report mode,in my splitter window.When I'm trying to insert items, I see that although I can add the first item data, I cannot see other items(i.e. I can see Hello and the World column, but no entry under it. Help?? //Precreate window - //cs.style |= LVS_REPORT|LVS_SORTASCENDING; //set list styles //then InsertColumn(0,IDS_HELLO); InsertColumn(1,IDS_WORLD); CString szHello("Hello"); CString szWorld("World"); CListCtrl& list = GetListCtrl(); ZeroMemory((void*) &Item, sizeof(Item)); Item.mask = LVIF_TEXT; Item.iItem = 0; Item.iSubItem = 0; Item.pszText = (LPTSTR)(LPCTSTR)szSubject; list.InsertItem(&Item); list.SetItemText(0,1,(LPTSTR)(LPCTSTR)szWorld);

      Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
      PocketPC New menu Office addin

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Turn off the sort style, does it work then? If so, then the item you insert isn't ending up at index 0 because of sorting. You need to save the return value from InsertItem() which is the index that the item is actually inserted at, and use that index in the SetItemText() call. --Mike--    THERE IS NO     THERE IS NO    BUT THERE IS MAGIC PIXIE DUST  BUSINESS GENIE  CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber If privacy is outlawed, only outlaws will have privates.

      A 1 Reply Last reply
      0
      • M Michael Dunn

        Turn off the sort style, does it work then? If so, then the item you insert isn't ending up at index 0 because of sorting. You need to save the return value from InsertItem() which is the index that the item is actually inserted at, and use that index in the SetItemText() call. --Mike--    THERE IS NO     THERE IS NO    BUT THERE IS MAGIC PIXIE DUST  BUSINESS GENIE  CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber If privacy is outlawed, only outlaws will have privates.

        A Offline
        A Offline
        Amit Dey
        wrote on last edited by
        #3

        No, Mike, that did not solve it. I took another llok at the MFC rowlist sample, and it only works when I first enter the first item for all rows via InsertItem(), and then do SetItemText() for subitems. But no matter what I do, I can never make 'real' per row basis item insertion...ie an InsertItem() followed by SetItemText() for sub items before moving on to the next row.?? I have tried both CListCtrl::xxxx as well as ListView_xxx functions, but nothing works.:confused:

        Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
        PocketPC New menu Office addin

        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