|
-
Feb 7th, 2007, 04:12 AM
#1
[RESOLVED] Prevent a menu from popping up
When I right-click on a listview, a menu pops up with a number of options such as "delete the selected item" etc. Now, I want to prevent the menu from popping up when the listview is empty. So far I've used:
VB Code:
If ListView1.ListItems.Count = 0 Then mnuHidden.Visible = False
but I think it's not the way to go, as the menu is (very briefly) shown before is becomes invisible.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Feb 7th, 2007, 04:22 AM
#2
Re: Prevent a menu from popping up
 Originally Posted by krtxmrtz
When I right-click on a listview, a menu pops up with a number of options such as "delete the selected item" etc. Now, I want to prevent the menu from popping up when the listview is empty. So far I've used:
VB Code:
If ListView1.ListItems.Count = 0 Then mnuHidden.Visible = False
but I think it's not the way to go, as the menu is (very briefly) shown before is becomes invisible.
Forget about it... I think I'm still asleep this morning...
VB Code:
Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
If ListView1.ListItems.Count > 0 Then
PopupMenu mnuHidden, , ListView1.Left + X, ListView1.Top + Y
End If
End If
End Sub
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
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
|