Results 1 to 9 of 9

Thread: Tree View Right-Click *RESOLVED*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Tree View Right-Click *RESOLVED*

    I have a popup menu that appears when I right click a node.

    Two things :

    1) How can I tell when I click on a child or a parent node??

    2) When I right click on a node and it's not a node that is already selected, the menu appears as it should do, but the focus returns to the previously selected node.

    Any ideas?


    Kind Regards,


    Matt.
    Last edited by MattJH; Jul 17th, 2003 at 03:10 AM.

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    1) How can I tell when I click on a child or a parent node?

    Dim sNodePath As String()
    sNodePath = Split(myTreeView.SelectedNode.FullPath(), "\", 2)

    if sNodePath.Length = 1 then
    'top level
    elseif sNodePath.length = 2 then
    'second level
    end if
    -Shurijo

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298
    Thankyou for your help!!

    Much Appreciated

  4. #4
    Addicted Member
    Join Date
    Feb 2002
    Location
    closed
    Posts
    196
    as for question 2 you might want to check out this old post

    This should set the selected node to the one you have just right-clicked.

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Originally posted by Shurijo
    1)sNodePath = Split(myTreeView.SelectedNode.FullPath(), "\", )
    It may be a better practice to use split method of string class than split function.
    Last edited by Lunatic3; Jul 16th, 2003 at 03:07 PM.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Lunatic3
    It may be a better practice to use split method of string class than split function.
    I agree since this function is imported from VisualBasic namespace which is mostly used for backward code ...Just a thought

  7. #7
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    I know you have an answer but why not use
    if treenode.parent is nothing then
    'Parent Node
    else
    'Child Node
    End IF
    Wind and waves resolves all problems.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Thanks

    Thanks for all your help!!!!

  9. #9
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Originally posted by Pirate
    I agree since this function is imported from VisualBasic namespace which is mostly used for backward code ...Just a thought
    Split method of sting class should be faster too. Look here:http://www.vbforums.com/showthread.p...hreadid=198127
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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