|
-
October 31st, 2000, 09:55 AM
#1
CListControl
Hi All,
I have a doubt regarding the list control Deleteitem() and DeleteAllItem()s.
If I call DeleteItem() or DeleteAllItems(), Is list control going to delete associated item that's set by SetItemData().
Consider the following the situation,
Myrec *myRec = new Myrec();
// do some caluclations and fill Myrec.
// Add to list control
LVITEM pItem;
pItem.iItem = count;//lCount-1;
pItem.iSubItem = 0;
pItem.mask = LVIF_TEXT | LVIF_PARAM;
pItem.pszText = myRec->Name;
myCtrl.InsertItem( &pItem );
myCtrl.SetItemText(count, 1,myRec->ID;
myCtrl.SetItemData(count,(LPARAM)myRec);
After some time If I call myCtrl.DeleteAllites(), Is it going to delete the associated item myRec pointer(in heap) along with each row in list control?
Or do I need to store all my qrec pointers in a separate list while adding to list control, and delete them explicitly????
Thanks and Regards,
Ramana
-
October 31st, 2000, 10:22 AM
#2
Re: CListControl
No, CListCtrl definitely doesn't delete your MyRec pointers, because it doesn't know what to do and how. You have to delete them by yourself before DeleteAllItems via call GetItemData in a loop( just if you need to delete them )
-
October 31st, 2000, 10:40 AM
#3
Re: CListControl
Hi,
List Ctrl sends an LVN_DELETEITEM, and LVN_DELETEALLITEMS notifications when an item is deleted, so typically you would delete the myRect there.
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|