Re: FXTreeList

"John Selverian" <[email protected]> Thu, 9 Nov 2023 22:11:46 -0500
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization JAHM Software
Message-ID <[email protected]>
I figured it out:

 

 

 

/****************************************************************
*****************************************/

void MultiPlotWindow::expandCollapse(bool expand, FXTreeList*
treeList)

{

                FXTreeItem* head = nullptr;

                FXTreeItem* child = nullptr;

                FXTreeItem* child1 = nullptr;

 

 

                head = _treeList_TL->getFirstItem();

 

                while (head != nullptr)

                {

                                if (expand)

                                {

 
_expandAllInTreeView = true;

 
treeList->expandTree(head);

                                }

                                else

                                {

 
_expandAllInTreeView = false;

 
treeList->collapseTree(head);

                                }

 

 

                                child = head->getFirst();

 

                                while (child != nullptr)

                                {

                                                if (expand)

                                                {

 
_expandAllInTreeView = true;

 
treeList->expandTree(child);

                                                }

                                                else

                                                {

 
_expandAllInTreeView = false;

 
treeList->collapseTree(child);

                                                }

 

                                                if
(_includeMaterialNameLevelInTrees)

                                                {

 
child1 = child->getFirst();

 

 
while (child1 != nullptr)

                                                                {

 
if (expand)

 
{

 
_expandAllInTreeView = true;

 
treeList->expandTree(child1);

 
}

 
else

 
{

 
_expandAllInTreeView = false;

 
treeList->collapseTree(child1);

 
}

 

 
child1 = child1->getNext();

                                                                }

                                                }

 

                                                child =
child->getNext();

                                }

 

                                head = head->getNext();

                }

 

}

/****************************************************************
*****************************************/

 

 

 

 

From: John Selverian <[email protected]> 
Sent: Thursday, November 9, 2023 9:01 PM
To: [email protected]
Subject: [Foxgui-users] FXTreeList

 

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?

 

 

 

 

 

/****************************************************************
*****************************************/

void MultiPlotWindow::expandCollapse(bool expand, FXTreeList
*treeList)

{

                FXTreeItem* head;

 

                head = treeList->getFirstItem();

 

                for (int i = 0; i < treeList->getNumItems(); i++)

                {

                                if (head != nullptr)

                                {

                                                if (expand)

                                                {

 
_expandAllInTreeView = true;

 
treeList->expandTree(head);

                                                }

                                                else

                                                {

 
_expandAllInTreeView = false;

 
treeList->collapseTree(head);

                                                }

                                }

 

                                head = head->getNext();

                }

}

/****************************************************************
*****************************************/

 

/****************************************************************
*****************************************/

void MultiPlotWindow::expandCollapseAll(bool expand)

{

                expandCollapse(expand, _treeList_TL);

                expandCollapse(expand, _treeList_hidden_TL);

                return;

}

/****************************************************************
*****************************************/

 

 

 

 

Kind regards,

 

Js

_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users