Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treview - Find root node
Message
From
14/03/2009 10:21:34
 
 
To
14/03/2009 09:35:09
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01388033
Message ID:
01388044
Views:
64
This message has been marked as a message which has helped to the initial question of the thread.
If TreeView have multiple root nodes at top level wich then branch down to multiple levels.
If user click node at the deep end, how do I find root node of that branch.
I need actually string of that root node as they are all strings.


Here is a method called GetParentNode. You call it from the NodeClick method of the TreeView, passing it the key of the node that was clicked:
LPARAMETERS tcKey
*** Passed the key to a given node, returns an object reference to the parent node
LOCAL loNode, lcKey
*** Get the parent node
loNode = This.Nodes( tcKey ).Parent

*** If we do not have a parent
*** this is the root node
IF VARTYPE( loNode ) # 'O'
  RETURN This.Nodes( tcKey )
ELSE
  This.GetParentNode( loNode.Key )
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform