Typically the OnGetDispInfo() routine is called when the control wants you
to provide it with the information to display like text or an image. I've
never tried to use this routine to retrieve text from the control. I would
item or subitem.
index of the row/item/subitem passed in the NMLVDISPINFO object.
Thanks for the Reply.
Isn't it up to the user to set the mask to LVIF_TEXT, when setting the
value
in LVItem.pszText. Hope the user can still set a value to LVItem.pszText
without setting LVIF_TEXT flag. In this case, if user has just set the
text
without setting the flag, the option of checking for the flag and
retrieving
data will not work out?
When should pDispInfo->item.pszText have value and when shouldn't it have
an
value? What i observed is, suppose if the list view control has a value
"4".
At the click of List View control pDispInfo->item.pszText is empty and
only
when the focus goes out pDispInfo->item.pszText is populated with the
value
4.
I am not able to comprehend how the below casting works
NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
How are the values in NMHDR converted to NMLVDISPINFO?
Please point me to a simple article without much complications, from whcih
NMLVDISINFO could be learned.
Regards,
Alamelu N
"Tom Serface" wrote:
As David says, you should text for the LVIF_TEXT before using this
buffer.
This routine gets called for lots of different reasons. This article may
be
interesting to you:
http://blogs.msdn.com/oldnewthing/archive/2007/03/08/1834556.aspx
Also, when setting the text be sure you don't exceed the buffer.
Tom
"Alamelu" <Alamelu@discussions.microsoft.com> wrote in message
news:C8BE2CA6-58BE-40EC-B7FD-3AC6459F7295@microsoft.com...
In the below code "pDispInfo->item.pszText" is holding some address and
is
pointing to some junk value only in release mode, which gives me a
uncaught
expection in that line. But in debug mode "pDispInfo->item.pszText" is
NULL.
void ClassA::OnBeginEditList(NMHDR *pNMHDR, LRESULT *pResult,CListCtrl
&theList)
{
NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
CString strData = pDispInfo->item.pszText ; //Gives uncaught
expection
}
Can any body guess why would "pDispInfo->item.pszText" point to some
address
and hold some junk value when we begin to edit List view control. But
logically "pDispInfo->item.pszText" should be NULL when we begin to
edit
the
control, isn't it? Why this strange behaviour happens only in release
mode
Is there any flag, to check if "pDispInfo->item.pszText" holds any
value
and
accordingly retrieve?
Regards,
Alamelu N