Search the Community
Showing results for tags 'virtual'.
Found 1 result
-
delphi Virtual Listview does not work because 'un-select' is not reported
Bart Kindt posted a topic in Windows API
I have a unit which tries to use the TListView in Virtual mode, by setting OwnerData to true. Theroretically all this should simply work, as long as I monitor the OnData, OnSelectItem, OnDataStateChange and possibly OnChange. But what happens, it that all 'OnSelect's are reported by Windows, but NOT all 'unSelect's. As a result, my VirtualItemList end up with more and more Selected Items, while in reality, there is (for example) only 1 Selected Item in the ListView. Below is an (Log) example of what happens: = I click on item 0: OnSelectItem: Item not assigned! OnChange: Index=0 Virtual Count=3001 Item=Caption 0 Selected=TRUE OnSelectItem: Item=Caption 0 Item.Selected=TRUE Selected=TRUE = I now shift-click on Item3, to multi-select all 4 Items: VirtualItemList.OnSelectItem: Item not assigned! *** OnDataStateChange: Start=0 End=3 *** OnDataStateChange: 0 Item: Caption 0 Selected=TRUE *** OnDataStateChange: 1 Item: Caption 1 Selected=TRUE *** OnDataStateChange: Changing VirtualItem Caption 1 to TRUE *** OnDataStateChange: 2 Item: Caption 2 Selected=TRUE *** OnDataStateChange: Changing VirtualItem Caption 2 to TRUE *** OnDataStateChange: 3 Item: Caption 3 Selected=TRUE *** OnDataStateChange: Changing VirtualItem Caption 3 to TRUE OnChange: Index=0 Virtual Count=3001 Item=Caption 0 Selected=TRUE OnChange: Index=3 Virtual Count=3001 Item=Caption 3 Selected=TRUE MouseUp: Base Selcount=4 Virtual=4 REAL=4 NOTE: - OnSelectItem is NOT called during 'Shift-Click' for the Selected items. - I now must use OnDataStateChange to Select these. - OnChange is ONLY called for Index 0 and 3. Not for the ones in between. = I now click on Item 4. (This should UN-select all other Items. It does do so on the screen...) OnSelectItem: Item not assigned! OnChange: Index=3 Virtual Count=3001 Item=Caption 3 Selected=FALSE *** OnChange: Caption 3 has changed to: FALSE OnChange: Index=4 Virtual Count=3001 Item=Caption 4 Selected=TRUE *** OnChange: Caption 4 has changed to: TRUE OnSelectItem: Item=Caption 4 Item.Selected=TRUE Selected=TRUE MouseUp: Base Selcount=1 Virtual=1 REAL=4 NOTE: - The OnChange only reported UNSelect for Item 3, and the Select for Item 4, but there is no event anywhere for Item 0, 1 and 3. - I now have FOUR Selected items in my Virtual List (The SelCount is hard overwritten from the ListView Selcount) - OnDataStateChange is NEVER called to report all the UN-Selects. The entire Test program source code can be downloaded here (200k): https://sartrack.nz/temp/VirtualListViewTest.zip I really wonder if it possible at all to do this, as this seems to be a Windows issue. Using Windows 10, Delphi 11.