|
-
Apr 13th, 2000, 02:12 PM
#1
Thread Starter
Hyperactive Member
i am having a little trouble with listview control. how can i check if the cursor was not clicked on an icon. i want to know if the user is clicking on the cursor or on the empty area.
-
Apr 13th, 2000, 09:24 PM
#2
You can do something like this. Use the MouseDown event of the ListView to check if the user has selected anything in a ListView:
Code:
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim itmListItem As ListItem
Set itmListItem = ListView1.HitTest(x, y)
If itmListItem Is Nothing Then
MsgBox "Nothing is selected."
Else
MsgBox "You selected " & itmListItem.Text
End If
End Sub
Regards,
-
Apr 13th, 2000, 10:28 PM
#3
Thread Starter
Hyperactive Member
you suggestion works fine with single click, but when a user selects an item, and then double clicks on the listview control's blank area, the item which was selected the last time receives the focus. what i want is that when the user selects an item, and if he double clicks outside an item, the item should lose the focus just like in windows explorer.
i hope you get what i mean.
-
Apr 13th, 2000, 10:36 PM
#4
You can try something like this:
Code:
Option Explicit
Private itmListItem As ListItem
Private Sub ListView1_DblClick()
If itmListItem Is Nothing Then
MsgBox "Nothing is selected."
Else
MsgBox "You selected " & itmListItem.Text
End If
End Sub
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set itmListItem = ListView1.HitTest(x, y)
End Sub
-
Apr 13th, 2000, 10:47 PM
#5
Thread Starter
Hyperactive Member
but the item still doesnt loose the focus, it receives the focus again after double click, i want it to work like windows explorer.
-
Apr 15th, 2000, 01:38 AM
#6
Thread Starter
Hyperactive Member
can anyone help,.....anyone???
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
|