Results 1 to 4 of 4

Thread: treeview - parents, children

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Greece
    Posts
    26
    Hi.. I am using a treeview ctrl to deslpay some data. I want to add a right-click functionality to those nodes only which do not have children !
    I am using this code (which is not working):

    ---------
    Private Sub treeview_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)

    If Button = vbRightButton Then

    If treeview.SelectedItem.Children > 0 Then
    Exit Sub
    Else
    PopupMenu mnuRecords
    End If
    End If

    End Sub
    ---------

    What am I doing wrong?



  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Use the MouseUp event instead of the MouseDown event and that will solve your problem.

    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Greece
    Posts
    26
    thanks for the quick reply...
    I have used the mousedown and not the mouseup b'cos I have noticed a weird behavior with this..that is I have to dbl-right-click to show the popup!!!

    anyway...

    I will rephrase the problem in another thread in order to work it out in another way!


  4. #4
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    There must be a problem with some other of your code then because, trust me, detecting a right-click through the mouseup event to make a popupmenu appear does not require a double-click.

    Promise!!!


    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

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