I have the following small issue. A pretty old MFC application being ported to C++11. There is a MFC CListCtrl in report view the data in which is being refreshed by a separate thread. Either manually or via a timer. The current implementation sets m_ListCtrl->SetRedraw(FALSE); deletes all items then populates them back again. This causes a flicker. Also internally the items are sorted via GetItemData DWORD, setting each list items new position after sorting. The state of sorting is internal to CListCtrl.
What is the best design pattern to add new, update or remove deleted list items after the table has been modified? I am thinking of hashing the contents of the list item row, keeping a separate vector<RowObject> table current and after refresh and comparing hashes. Is this a right approach?
Or may be use m_ListCtrl->SetItemText on existing items? But how to deal with sorting in this case?