|
-
Jul 16th, 2003, 09:58 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jul 16th, 2003, 10:13 AM
#2
Addicted Member
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
-
Jul 16th, 2003, 11:02 AM
#3
Thread Starter
Hyperactive Member
Thankyou for your help!!
Much Appreciated
-
Jul 16th, 2003, 02:27 PM
#4
Addicted Member
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.
-
Jul 16th, 2003, 03:03 PM
#5
Frenzied Member
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
-
Jul 16th, 2003, 03:55 PM
#6
Sleep mode
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
-
Jul 17th, 2003, 03:28 AM
#7
Addicted Member
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.
-
Jul 17th, 2003, 03:32 AM
#8
Thread Starter
Hyperactive Member
Thanks
Thanks for all your help!!!!
-
Jul 17th, 2003, 04:01 AM
#9
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|