mfc >> GetItemData

by Ririko Horvath » Tue, 01 Feb 2005 02:22:48 GMT

Hello,

Does anyone know under what condition CListCtrl::GetItemData(idx)
returns 0 for a multi-column list control. I am passing a valid index.

Thank You




mfc >> GetItemData

by tawright915 » Tue, 01 Feb 2005 02:34:45 GMT


According to the MSDN it's supposed to return a 32 bit value associated
with that item.

Have you stepped thru your code to see what value is in "idx"?
And how are you setting this value...you should be using SetItemData
moving the value into LVITEM.lParam.

Tom




mfc >> GetItemData

by Ririko Horvath » Tue, 01 Feb 2005 03:34:23 GMT

The value I am using for "idx" is correct, however I'm not using
SetItemData(idx,dwData) to set the value for this item. How do you set
the32-bit value for dwData if want to change the text color for this item
only.
Thanks






GetItemData

by Jonathan Wood » Tue, 01 Feb 2005 07:21:41 GMT

This is normal behavior for all types of list controls until you call
SetItemData(idx) to set the value to something different.

All types of list controls (and many other types of controls as well) do not
use this 32-bit value internally. Rather, it is a place for you to store
information associated with each item in the list. The control does not know
or care what the nature of this data is or if you even use it.

What were you expecting GetItemData to return?

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm







GetItemData

by Ririko Horvath » Tue, 01 Feb 2005 21:28:32 GMT

Thank you for your response. I was expecting the GetItemData function to
return32-bit lParam member of LVITEM for the specified row. Does the value
of lPARAM need to be set to be set to something using SetItemData. Do you
know where I can get a documentation that explains lParam.

Thank You!


not
know






GetItemData

by Jonathan Wood » Wed, 02 Feb 2005 02:08:47 GMT

It is documented at the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/structures/lvitem.asp

It's not entirely clear to me what you are trying to do.

--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm



value








Similar Threads

1. Problems with GetItemData in CListCtrl

2. CListctrl::GetItemData causing problem

Hi,
    I am working in visual studio 2005 environment. While retrieving
data from GetItemData it returns junk value. The same code is working
fine in visual studio 6 but causing problem in visual studio 2005.

To get data i am doing like
  sTemp = (TCHAR*)m_pListCtrl->GetItemData(0);

and while inserting data i am doing like
        LVITEM lvi = {0};
	lvi.mask = LVIF_TEXT|LVIF_PARAM;
	lvi.iItem = m_pListCtrl->GetItemCount();
	lvi.lParam = (LPARAM)sTemp;
        int iRetval = m_pListCtrl->InsertItem (&lvi);

where sTemp is wide char string

Please can you help me.

-Bhagyashree

3. CListCtrl::GetItemData() return NULL

4. about CComboBox::GetItemData(int index) return value

Hello, I have a question:

Method DWORD CComboBox::GetItemData(int index)

returns the 32-bit value associated with the item, or CB_ERR if an error 
occurs.

DWORD is defined as unsigned long, CB_ERR is -1,
How can -1 fall into the range of unsigned long?

I am using VS6


Thank you
Vaclav 

5. How to GetItemData of a Checked Item of a CCheckListBox?