Virtual Listview: Never get a LVN_GETDISPINFO case

Dear Experts

I have tried to make a virtual listview, but in OnChildNotify I never get the LVN_GETDISPINFO case and therefore I don't get to write data to the view. In initializing the listview, I have chosen LVS_OWNERDATA. Furthermore I have a GetDispInfo function and what I think is a proper OnChildNotity from an example. I think I might miss some message mapping, but where and how? I can find some listctrl examples, but I can't figure it out from them.

I hope you can help me, thank you very much in advance

Peter
CSeriesView::CSeriesView()
{
	// TODO: add construction code here
	m_dwDefaultStyle |= ( LVS_OWNERDATA | LVS_REPORT | LVS_EX_GRIDLINES );
 
}
 
void CSeriesView::GetDispInfo(LVITEM* pItem)
{
	if(pItem->mask & LVIF_TEXT)
	{
		int i = pItem->iItem;
		int j = pItem->iSubItem;
		CSeriesDoc *iDoc = GetDocument();
                                          
                                           blah blah blah...
		
		_tcscpy_s(pItem->pszText, pItem->cchTextMax, (LPCTSTR)s_.c_str());
	}
}
 
BOOL CSeriesView::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
	if(message == WM_NOTIFY)
	{
		NMHDR* phdr = (NMHDR*)lParam;
 
		// these 3 notifications are only sent by virtual listviews
		switch(phdr->code)
		{
		case LVN_GETDISPINFO:
			{
				NMLVDISPINFO* pLvdi;
 
				pLvdi = (NMLVDISPINFO*)lParam;
				GetDispInfo(&pLvdi->item);
			}
			if(pResult != NULL)
			{
				*pResult = 0;
			}
			break;
		case LVN_ODCACHEHINT:
			{
				NMLVCACHEHINT* pHint = (NMLVCACHEHINT*)lParam;
 
				PrepareCache(pHint->iFrom, pHint->iTo);
			}
			if(pResult != NULL)
			{
				*pResult = 0;
			}
			break;
		/*case LVN_ODFINDITEM:
			{
				NMLVFINDITEM* pFindItem = (NMLVFINDITEM*)lParam;
				int i = FindItem(pFindItem->iStart, &pFindItem->lvfi);
				if(pResult != NULL)
				{
					*pResult = i;
				}
			}
			break;*/
		default:
			return CListView::OnChildNotify(message, wParam, lParam, pResult);
		}
	}
	else
		return CListView::OnChildNotify(message, wParam, lParam, pResult);
 
	return TRUE;
}

Open in new window

PeterTokeHedenAhlgrenAsked:
Who is Participating?
 
PeterTokeHedenAhlgrenAuthor Commented:
I solved it.Simply missed a line with something like

GetListCtrl().SetItemCountEx(100);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.