• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 964
  • Last Modified:

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

0
PeterTokeHedenAhlgren
Asked:
PeterTokeHedenAhlgren
1 Solution
 
PeterTokeHedenAhlgrenAuthor Commented:
I solved it.Simply missed a line with something like

GetListCtrl().SetItemCountEx(100);
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now