Community articleUFLGetParent function
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function, along with UFLGetChildren, is used to traverse vertically along the form hierarchy. UFLGetParent returns the parent of a node. If the node has no parent, NULL is returned. A form's structure can be traversed up to the root node using an iterator such as a while loop.


   formNodeP UFLGetParent(
      formNodeP theChildNode


Table 1. Function parameters
theChildNodeformNodePThe formNodeP to retrieve its parent from.


The formNodeP that represents the parent node or NULL if no such parent exists.


The following example uses UFLGetParent in a while loop to vertically traverse up the form hierarchy until the top node on the branch is reached. The top node is returned.
   formNodeP getTopNode(formNodeP *theNode)
   formNodeP theTopNode = NULL;
   formNodeP theParent;
      if(*theNode != NULL)
         theParent = UFLGetParent(*theNode);
      while (theParent != NULL)
         theTopNode = theParent;
         theParent = UFLGetParent(theParent);
      return theTopNode;

Parent topic:
FormNodeP functions