Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force update of a virtual CListCtrl

Tags:

mfc

clistctrl

I have a CListCtrl containings about 2500 differents elements consisting of a 48x48 icon and text.

Due to the amount of data I implemented it as a virtual list providing

ON_NOTIFY(LVN_GETDISPINFO, IDC_LST_ICONS, &CWGDIconSearchDlg::OnLvnGetdispinfoLstIcons)
ON_NOTIFY(LVN_ODFINDITEM, IDC_LST_ICONS, &CWGDIconSearchDlg::OnLvnOdfinditemLstIcons)

My problem is when I change list content these callback get never called.

How can I force it?

like image 756
Fabio C. Avatar asked Oct 23 '25 16:10

Fabio C.


1 Answers

Windows cannot know that you have changed an item in virtual list.

In order to trigger a redraw of your CListCtrl, you must call yourcontrol.Invalidate() which will trigger a repaint of your control.

like image 93
Jabberwocky Avatar answered Oct 25 '25 22:10

Jabberwocky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!