listview problem
-
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 -
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 addinTurn 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 theSetItemText()
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. -
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 theSetItemText()
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.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