Results 1 to 3 of 3

Thread: Execute a Menu when List is right clicked

  1. #1

    Thread Starter
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Execute a Menu when List is right clicked

    Okay, I have a listview, all filled out etc. I am trying to add a few nice options on to it, and I thought the best way to organize it would be in a Menu. Except, I have a problem:

    How would I pop up the menu when a row was right clicked on the listview?
    Age - 15 ::: Level - Advanced
    If you find my post useful please ::Rate It::


  2. #2
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Execute a Menu when List is right clicked

    VB Code:
    1. Private Sub ServerB_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.    If Button = vbRightButton Then
    3.         PopupMenu PopMenu 'must be valid top level menu item
    4.     End If
    5. End Sub

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Execute a Menu when List is right clicked

    This will popup a menu, and select the item you right mouse clicked on.
    VB Code:
    1. Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim lvwItem As ListItem
    3.     If Button = vbRightButton Then
    4.         Set lvwItem = ListView1.HitTest(x, y)
    5.         If Not lvwItem Is Nothing Then
    6.             lvwItem.Selected = True
    7.             PopUpMenu mnuFile
    8.         End If
    9.     End If
    10. 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
  •  



Click Here to Expand Forum to Full Width