-
June 2nd, 2003, 04:01 AM
#1
Listview double-click delete row
Hi guys,
I have a listview with three columns.
A user may double-click a row to remove that row from the listview (and all rows below move up to take the deleted row's place).
Problem is, if the user double clicks in the empty space *below* the list items, the list item last selected is deleted!
How do I stop this behaviour?
I assume I'd have to test for validity of the double-click event but how do I test for a user double clicking the vacant area?
Thanks,
Mark
-
June 2nd, 2003, 05:03 AM
#2
Hi..
you need to use ListView1.HitTest method..
It will return the ListItem under cursor when you call the method or it returns Nothing..
the problem is to get the parameters to HitTest method (X,Y) Coordinates
to do so you have 2 methods :
1)Handle :
Code:
ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
to save the last x,y coordinates in global variables and pass them to HitTest in the DblClick event
2) use the API GetCursorPos to get the location of mouse on the screen then convert it to x,y of the listview..
Hope this can help..
-
June 2nd, 2003, 05:54 AM
#3
That worked awesomely! I never even knew there was a "HitTest" method!
Live and learn...
Thanks for the answer!
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|