Click to See Complete Forum and Search --> : CListCtrl update


May 24th, 1999, 05:51 AM
How can I update a CListCtrl automaticaly when using a dynaset database.

Jim Watters
May 25th, 1999, 03:43 PM
in OnUpdate of the view I use this code to force a refresh of the CListCtrl


LV_ITEM lvi;
memset(&lvi, 0, sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.pszText = LPSTR_TEXTCALLBACK;
lvi.iSubItem = 0;

for (i=0; i < NumOfData; i++)
{
lvi.iItem = i;
lvi.lParam = i;
m_List.InsertItem(&lvi);
}
}

Jim Watters
May 25th, 1999, 04:01 PM
IF the number of rows did not change then it is only a matter of invalidateing what needs to be updated.
Do the following to only redraw the rect of the row that needs to be

m_List.GetItemRect(row, &rect, LVIR_BOUNDS);
InvalidateRect(&Rect);