Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Basic 6 Listview Annoyance

Tags:

listview

vb6

I've populated a listview with names using Icon View.

The listview isn't full, and when you accidently catch a blank area of the listview it actually registers a click on the first item in the listview, which is triggering an event that hasn't actually happened.

Is there a way of catching a "non-click"

Thanks

John

enter image description here

like image 672
John Moore Avatar asked Dec 14 '25 05:12

John Moore


2 Answers

I seem to recall needing to use the HitTest method to validate the ListItem that was just clicked. I captured the X/Y coords in the MouseDown then in the Click I validated that the click actually landed on a ListItem.

like image 158
tcarvin Avatar answered Dec 15 '25 19:12

tcarvin


The HitTest method mentioned by tcarvin is sound. If you don't need the generic Click event though, it would be easier to opt for the ItemClick event instead. This should only fire when actually clicking on an item.

like image 35
JC2k8 Avatar answered Dec 15 '25 21:12

JC2k8



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!