Example of Traversing an Outline (VB)

This example demonstrates the use of the outline tree. TraverseTree is a recursive algorithm that traverses the outline tree to provide access to all outline members. It selects each member in turn, allowing processing on each, until it reaches the last member. A comment in the code notes the opportunity for added processing.

This algorithm incorporates several VB Outline API commands.

Before executing this code, initialize the API and open the outline. Following this code, close the outline and terminate the API.

TraverseTree (ESB_HOUTLINE_T)
{
   ESB_HMEMBER_T hMember;
   ESB_STS_T  sts = 0;

   sts = EsbOtlGetFirstMember(hOutline, &hMember);
   if (!sts && hMember)
     sts = TraverseTreeRecurse(hOutline, hMember); 
}

TraverseTreeRecurse(ESB_HOUTLINE_T hOutline, ESB_HMEMBER_T hMember) 
{
   ESB_MEMBERINFO_T MbrInfo;
   ESB_HMEMBER_T, hChild;
   ESB_STS_T  sts = 0;

   while (!sts && hMember)
   {
     sts = EsbOtlGetMemberInfo (hOutline, hMember, &MbrInfo);

      /* ADD THE PROCESSING FOR EACH MEMBER HERE. */

      if (!sts)
     {
       sts = EsbOtlGetChild(hOutline, hMember, &hChild);
       if (!sts && hChild)
       {
         sts = TraverseTreeRecurse(hOutline, hChild);
       }
     }
     sts = EsbOtlGetNextSibling(hOutline, hMember, &hMember);
   }
   return (sts); 
}