Omnis Technical Note TNNO0010
Tree lists - displaying nodes with a common parent
For Omnis Studio
By Omnis Technical Support
How do I display a list of all the nodes with a common parent?
An example library is provided with code to show how to display a list of all the nodes with a common parent. The user can click on any node, the code will find the parent and then create a list of the children of that parent node. This illustrates $nodeparent and $nextnode, as well as the use of the reference returned by OMNIS of the node that has been clicked on, pNodeItem. The $event method behind the main tree list is:
On evClickDo cl_NodeList.$clear()
Do $cfield.$currentnode() Returns li_Ref
Do li_Ref.$nodeparent() Returns li_Parent
Do $cfield.$nextnode(li_Parent,kTrue) Returns li_Child
While li_Child
Do cl_NodeList.$add(li_Child.$name)
Do $cfield.$nextnode(li_Child) Returns li_Child
End While
Redraw {wTreeNodes_1017} ;; list showing child nodes
Download a library from GitHub: https://github.com/OmnisStudio/Omnis-TreeNodes (for Studio 8.1.2 or above)
(or an archive treenodes.zip for Studio 4 or above, may require conversion)