-
listview context menu
hi. i need to know how to make sure the mouse is over an item in a listview
so i can pop up the appropriate context menu. basically, i don't want the
user clicking options for an item that he/she may not have intended. i'm
pretty sure this involves the HitTest method, but somehow i can't seem to
get the syntax right for that. i keep getting an error(91).
thank you for your time,
chris
-
Re: listview context menu
Chris,
HitTest method returns listitem object or nothing
You need to test the return...
Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim LI As ListItem
Set LI = ListView1.HitTest(x, y)
If LI Is Nothing Then
Label1.Caption = "Nothing under mouse pointer"
Else
Label1.Caption = LI.Text
End If
End Sub
Alex
"chris" <cguest19@yahoo.com> wrote:
>
>hi. i need to know how to make sure the mouse is over an item in a listview
>so i can pop up the appropriate context menu. basically, i don't want the
>user clicking options for an item that he/she may not have intended. i'm
>pretty sure this involves the HitTest method, but somehow i can't seem to
>get the syntax right for that. i keep getting an error(91).
>
>thank you for your time,
>chris
-
Re: listview context menu
Thanks a lot, Alex. Now everything works great.
"Alex" <AlexanderBirman@Yahoo.com> wrote:
>
>Chris,
>
>HitTest method returns listitem object or nothing
>
>You need to test the return...
>
>
>Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As
>Single, y As Single)
> Dim LI As ListItem
>
> Set LI = ListView1.HitTest(x, y)
> If LI Is Nothing Then
> Label1.Caption = "Nothing under mouse pointer"
> Else
> Label1.Caption = LI.Text
> End If
>
>End Sub
>
>
>Alex
>
>
>"chris" <cguest19@yahoo.com> wrote:
>>
>>hi. i need to know how to make sure the mouse is over an item in a listview
>>so i can pop up the appropriate context menu. basically, i don't want the
>>user clicking options for an item that he/she may not have intended. i'm
>>pretty sure this involves the HitTest method, but somehow i can't seem
to
>>get the syntax right for that. i keep getting an error(91).
>>
>>thank you for your time,
>>chris
>
-
'try this
Private Sub Lv_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Lv.MouseMove
If Lv.HitTest(e.X, e.Y).Item Is Nothing Then
Me.Text = 0
Else
Me.Text = 1
End If
End Sub
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|