|
-
October 13th, 1999, 06:50 PM
#1
Id for a row in CListCtrl
I have a linked list of objects that are displayed on a list control. When I double click on the row I want to be able to find the object
in my linked list from the info in the row, possibly some kind of row id that I can save in my object. Is there a standard way to do
this? I was thinking it had something to do with the lParam of the LV_ITEM structure, but I'm not sure how to use this.
Thanks in advance.
-
October 14th, 1999, 12:47 AM
#2
Re: Id for a row in CListCtrl
See CListCtrl::SetItemData and CListCtrl::GetItemData. I think the documentation has all the answers that you are seeking.
-
October 14th, 1999, 09:29 AM
#3
Re: Id for a row in CListCtrl
You can save linked list pointer in your list control using SetItemData() and retrive pointer back by GetItemData().you need to cast pointer to DWORD and vise versa.
like
m_ptrlistObject is a pointer to a object in list
pListCtrl->SetItemData(nIndex,(DWORD)m_ptrlistObject);
retrive
int nItem = pListCtrl->GetNextSelectedItem(pos);
m_ptrlistObject=(yourobject*)pListCtrl->GetItemData(nItem);
hope this works
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
|