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.



Description

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.

Function

   formNodeP UFLGetParent(
      formNodeP theChildNode
   );


Parameters

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


Returns

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

Example

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)
      {
         reportNodeInfo(&theParent);
         theTopNode = theParent;
         theParent = UFLGetParent(theParent);
      }
      return theTopNode;
   }


Parent topic:
FormNodeP functions