Results 1 to 3 of 3

Thread: Right click select in Treeview [Resolved]

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Resolved Right click select in Treeview [Resolved]

    I want the user to be able to right click select a node (then a popup menu shows)

    right now I have to left click to select it then right click for the popup
    Last edited by Static; Jun 15th, 2005 at 03:02 PM.
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Right click select in Treeview

    Use the HitTest method in the MouseDown event to see if a node exists at that location.

    VB Code:
    1. Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim objNode As Node
    3.     If Button = vbRightButton Then
    4.         Set objNode = TreeView1.HitTest(x, y)
    5.         If Not objNode Is Nothing Then
    6.             objNode.Selected = True
    7.             'popup your menu
    8.         End If
    9.     End If
    10. End Sub

  3. #3

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Right click select in Treeview

    Lol.. just got it and came in to delete the post

    Thanks anyway Bruce! (I will leave the post for others)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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