Re: FXTreeList

Jeroen van der Zijp <[email protected]> Thu, 9 Nov 2023 20:49:54 -0600
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization FOX Toolkit
Message-ID <[email protected]>
On Thu, 9 Nov 2023 21:00:51 -0500
"John Selverian" <[email protected]> wrote:

> I've been driving myself crazy with this. I have a 2 level
> FXTreeList. I can expand and collapse the entire tree with this
> code. I want to add a 3rd level to it. When I do I can't figure
> out how to expand and collapse all of the levels. Can you have a
> 3 level tree list?

Sure, no real limit of #levels or #items.

A non-recursive way to travel through all the items:


    item=startitem;
    while(1){

      expandTree(item,true);
     
      if(item->first){ item=item->first; continue; }

nxt:  if(item==startitem) break;

      if(item->next){ item=item->next; continue; }

      item=item->parent;

      goto nxt;
      }


This convoluted bit of code should visit all nodes from startitem
and its children, in non-recursive way that avoid potentially disastrous
recursion into deep tree hierarchies...


  hope this helps,







                    -- JVZ