Results 1 to 11 of 11

Thread: [RESOLVED] Treeview Highlight Problem.

  1. #1

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Resolved [RESOLVED] Treeview Highlight Problem.

    I expect this is probably a simple answer, but I can't find it.

    When you left click on a node, it highlights it. When I right click on a node it doesn't move the highlight from the last selected node.

    I have code in the treeview MouseDown for a context menu.
    The menu items are bases on the SelectedItem.Key of the treeview - which is still the last selected node.

    How do I get around this problem??

    Thanks
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  2. #2

  3. #3

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Treeview Highlight Problem.

    Quote Originally Posted by MartinLiss
    Does the highlighting work if you comment out the code in the MouseDown event?
    Yes it does.

    Does this mean that I have to put this code somewhere else?
    I have it in mousedown, not mouseup because I want to see if the user is calling the context menu before the node loads a file into a RTB.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  4. #4

  5. #5

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Treeview Highlight Problem.

    Quote Originally Posted by MartinLiss
    Please post the MouseDown code.
    Here it is:

    vb Code:
    1. Private Sub tvwCode_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.  
    3. If Button = vbRightButton Then
    4.  
    5.     With tvwCode
    6.         Select Case Left(.SelectedItem.Key, 1)
    7.             Case Is = "S"
    8.                 rcmitmAddNewNode.Enabled = True
    9.                 rcmitmDeleteNode.Enabled = False
    10.                 rcmitmReNameNode.Enabled = False
    11.                 ShowTvwMenu
    12.  
    13.             Case Is = "N"
    14.                 rcmitmAddNewNode.Enabled = True
    15.                 rcmitmDeleteNode.Enabled = True
    16.                 rcmitmReNameNode.Enabled = True
    17.                 ShowTvwMenu
    18.             Case Is = "C"
    19.                 rcmitmAddNewNode.Enabled = False
    20.                 rcmitmDeleteNode.Enabled = True
    21.                 rcmitmReNameNode.Enabled = True
    22.                 ShowTvwMenu
    23.             Case Else
    24.                 rcmitmAddNewNode.Enabled = False
    25.                 rcmitmDeleteNode.Enabled = False
    26.                 rcmitmReNameNode.Enabled = False
    27.                 ShowTvwMenu
    28.             End Select
    29.     End With
    30. End If
    31.  
    32. End Sub
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  6. #6

  7. #7

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Treeview Highlight Problem.

    Quote Originally Posted by MartinLiss
    Can you also please post the code for ShowTvwMenu?
    Don't know if this helps much
    vb Code:
    1. Private Sub ShowTvwMenu()
    2.  
    3. PopupMenu TvwMenu
    4.  
    5. End Sub
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  8. #8

  9. #9

  10. #10

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Treeview Highlight Problem.

    thans Martin, I will give it a go.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  11. #11

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Treeview Highlight Problem.

    Quote Originally Posted by MartinLiss
    ... or perhaps right after

    If Button = vbRightButton Then
    Yep, this one worked thanks.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

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