Updating subitem value in virtual list control(LVS_OWNERDATA)

  • Thread starter Thread starter sgrm123
  • Start date Start date
S

sgrm123

Guest
Hi,

In my MFC dialog based application I am using virtual list control(LVS_OWNERDATA)

A thread is used to monitor change in the data or vector used by listctrl and whenever there is a change of data for an item instead of drawing all the items in listctrl using SetItemCountEx() function, I am trying to update only the corresponding item using below code.

But when I click or select the corresponding item, then only the below code updating the value in UI.

NMLVDISPINFO nmlvDispInfo;
memset(&nmlvDispInfo,0,sizeof(nmlvDispInfo));

nmlvDispInfo.hdr.hwndFrom = m_ctrlLst.m_hWnd;
nmlvDispInfo.hdr.idFrom = IDC_LIST1;
nmlvDispInfo.hdr.code = LVN_GETDISPINFO;

nmlvDispInfo.item.mask = LVIF_TEXT;
nmlvDispInfo.item.state = 0;
nmlvDispInfo.item.stateMask = 0;
nmlvDispInfo.item.pszText = (LPTSTR)strX.GetBuffer();
nmlvDispInfo.item.cchTextMax = 200;

nmlvDispInfo.item.iItem = iItem;
nmlvDispInfo.item.iSubItem = 1;

::SendMessage(this->m_hWnd,WM_NOTIFY,(WPARAM)nmlvDispInfo.hdr.idFrom,(LPARAM)&nmlvDispInfo);




If I call SetItemCountEx(), UI is flickering thats why I tried to update only one item.
please help me to resolve this issue.

Continue reading...
 
Back
Top