O$ Node Full Path

Barnett, David dbarne04 at harris.com
Mon Apr 6 15:39:08 EDT 2009

Re: "i like when the user clicks on a node to have the full
path from the node selected back to the root node."


A simple loop will help build up the 'path'. In the $event method of your tree, put:

On evClick
  Do method getNodeFullName ($cobj.$currentnode()) Returns #S3
  OK message  {Fullpath=[#S3]}

Add a method to the tree object called getNodeFullName, with with 1 param, pNodeRef (itemref), and 1 local var, lFullName (char(10000)) long enough to hold the full path text. In that method put: 

If pNodeRef.$level>1
  Do method getNodeFullName (pNodeRef.$nodeparent) Returns lFullName
  Quit method con(lFullName,'/',pNodeRef().$name)
  Quit method pNodeRef.$name()
End If

Note that the method is called recursively passing the parent node each time until you reach the top level node. It builds up the path with the name from each level of the tree. Adapt as you wish.


David Barnett
Senior Software Engineer
Advertising Solutions
Harris Corporation, Broadcast Communications
T: +1-212-303-4273
E: David.Barnett at harris.com  

More information about the omnisdev-en mailing list