|
-
Apr 19th, 2007, 09:32 AM
#1
Thread Starter
Frenzied Member
[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
-
Apr 19th, 2007, 11:23 AM
#2
Re: Treeview Highlight Problem.
Does the highlighting work if you comment out the code in the MouseDown event?
-
Apr 19th, 2007, 11:29 AM
#3
Thread Starter
Frenzied Member
Re: Treeview Highlight Problem.
 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.
-
Apr 19th, 2007, 11:31 AM
#4
Re: Treeview Highlight Problem.
Please post the MouseDown code.
-
Apr 19th, 2007, 11:35 AM
#5
Thread Starter
Frenzied Member
Re: Treeview Highlight Problem.
 Originally Posted by MartinLiss
Please post the MouseDown code.
Here it is:
vb Code:
Private Sub tvwCode_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
With tvwCode
Select Case Left(.SelectedItem.Key, 1)
Case Is = "S"
rcmitmAddNewNode.Enabled = True
rcmitmDeleteNode.Enabled = False
rcmitmReNameNode.Enabled = False
ShowTvwMenu
Case Is = "N"
rcmitmAddNewNode.Enabled = True
rcmitmDeleteNode.Enabled = True
rcmitmReNameNode.Enabled = True
ShowTvwMenu
Case Is = "C"
rcmitmAddNewNode.Enabled = False
rcmitmDeleteNode.Enabled = True
rcmitmReNameNode.Enabled = True
ShowTvwMenu
Case Else
rcmitmAddNewNode.Enabled = False
rcmitmDeleteNode.Enabled = False
rcmitmReNameNode.Enabled = False
ShowTvwMenu
End Select
End With
End If
End Sub
-
Apr 19th, 2007, 11:38 AM
#6
Re: Treeview Highlight Problem.
Can you also please post the code for ShowTvwMenu?
-
Apr 19th, 2007, 11:42 AM
#7
Thread Starter
Frenzied Member
Re: Treeview Highlight Problem.
 Originally Posted by MartinLiss
Can you also please post the code for ShowTvwMenu?
Don't know if this helps much
vb Code:
Private Sub ShowTvwMenu()
PopupMenu TvwMenu
End Sub
-
Apr 19th, 2007, 11:53 AM
#8
Re: Treeview Highlight Problem.
Put this at the end of the MouseDown code.
tvwCode.SelectedItem = tvwCode.HitTest(x, y)
-
Apr 19th, 2007, 11:54 AM
#9
Re: Treeview Highlight Problem.
... or perhaps right after
If Button = vbRightButton Then
-
Apr 19th, 2007, 12:07 PM
#10
Thread Starter
Frenzied Member
Re: Treeview Highlight Problem.
thans Martin, I will give it a go.
-
Apr 19th, 2007, 04:05 PM
#11
Thread Starter
Frenzied Member
Re: Treeview Highlight Problem.
 Originally Posted by MartinLiss
... or perhaps right after
If Button = vbRightButton Then
Yep, this one worked thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|