Results 1 to 2 of 2

Thread: [RESOLVED] Prevent a menu from popping up

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [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:
    1. 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)

  2. #2

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Prevent a menu from popping up

    Quote 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:
    1. 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:
    1. Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Button = vbRightButton Then
    3.         If ListView1.ListItems.Count > 0 Then
    4.             PopupMenu mnuHidden, , ListView1.Left + X, ListView1.Top + Y
    5.         End If
    6.     End If
    7. 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
  •  



Click Here to Expand Forum to Full Width