A virtual list does not internally keep items information (like text and so on).Instead, it notifies its parent, asking info only for the itemssubitems which are currently displayed.That makes it a good choyce if dealing with a large number of items.For a listview control contained in a dialog resource, it can be done by setting True for Owner Data property.
![]() Load data in marrRows array instead of actually fill the list control. CListCtrl listCtrl GetListCtrl ( ); get listview control const int nCount marrRows. SetItemCountEx ( nCount ); set list items count return nCount. As said in the beginning, a virtual list doesnt internally keep items info. Instead, it sends LVNGETDISPINFO notification via WMNOTIFY message, each time it needs info about the items to be actually displayed. For a listview control we can use the wizard to map LVNGETDISPINFO in the parent dialog class or the reflected LVNGETDISPINFO notification, in a class derived from CListCtrl. In a class derived from CListView we can also use the wizard to map reflected LVNGETDISPINFO notification. DECLAREMESSAGEMAP ( ) afxmsg void OnLvnGetdispinfo ( NMHDR pNMHDR, LRESULT pResult ). From its member of type LVITEM, we can get which info is required (text, image, etc) and the index of item and subitem that is being displayed. Next, we have to fill that structure with the information from an external data collection. ![]() As can be seen in the screenshot, the virtual list worked over ten times faster. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |