Skip to main content
Participating Frequently
December 31, 2019
Question

Indesgin - collapse treeview

  • December 31, 2019
  • 2 replies
  • 1463 views

Hello everobody,

I have build a Window with a TreeView and 2 radio buttons.

1 radio button to expand all nodes // 1 radio button to collapse all nodes

OnClick on each radio button called a specific recursive function that expand or collapse my tree : 

// Expand all treeview nodes 
function expand_tree(my_treeview){
    my_treeview.expanded = true;
    var branches = my_treeview.items;
    for (var i = 0; i < branches.length; i++) {
        if (branches[i].type == 'node') {
            expand_tree (branches[i]);
        }
    }
}
// Collapse all treeview nodes 
function collapse_tree(my_treeview){
    my_treeview.expanded = false;
    var branches = my_treeview.items;
    for (var i = 0; i < branches.length; i++) {
        if (branches[i].type == 'node') {
            collapse_tree (branches[i]);
        }
    }
}

 

expand_tree function expand all nodes into my tree

But, collapse_tree function seems to do nothing…

I think my_treeview.expanded = false is the problem. 

I test it with my_treeview.collapsed = true but unsuccessfully

Do you have any idea ?

Thank you

This topic has been closed for replies.

2 replies

Community Expert
January 7, 2020

Hi Stéphane,

think, we are still lucky with tree view and InDesign.

With PhotoShop it's not available anymore since Flash was removed:

 

February 15, 2017

Photoshop UI toolkit for plug-ins and scripts

Known issues

 

The Flash Player widget is no longer supported. It is not possible to play SWF/Flash/Flex files through the script UI any longer.
Treeview widget is not supported.
Graphics drawing is not supported on Checkbox and Radiobutton widgets.
Button background color cannot be changed.
Font styles on text are not supported

 

https://helpx.adobe.com/photoshop/using/ScriptUI.html#Knownissues

 

Regards,
Uwe Laubender

( ACP )

 

// EDITED: ADDED DETAILS

tjprodAuthor
Participating Frequently
January 7, 2020

Doesn't smell right for a fix…

tjprodAuthor
Participating Frequently
January 6, 2020

Up please ^^

Nobody with same problem ? 

BarlaeDC
Community Expert
Community Expert
January 7, 2020

Hi,

 

I cannot see any obvious problem, are you able to share your whole project so that we have a place to start from?

 

Regards

 

Malcolm

Community Expert
January 7, 2020

I just tested on CC 2019 on Windows and I have same problem...

Expand is OK, Collapse no.

Test with initial collapse_tree function and your collapse_tree function.

So it's not a Mac-only bug. But a CC (2019?) bug?

If that's case, is there a solution ?Any hope to get a patch?

Anyway, thank you for testing


Hi Stéphane,

it's likely a bug that sneeked in with the change from InDesign CS6 version 8 to InDesign CC version 9.

As many bugs did that are with ScriptUI after changing InDesign from 32-bit to 64-bit code.

 

From InDesign CC version 9.3.0 on Windows:

 

Initial state after executing your code:

 

 

Clicked "Expand". Note the scroll bar is at the expected position showing the top items:

 

 

Then back to "Collapse". Obviously that is not working:

 

 

However I could collapse the items one by one "manually" in the item list using a click with my mouse:

 

 

 

Just testing the same with InDesign CS6 version 8.1.0 on the same system.

 

Initial state of window after executing your code:

( Note the difference in used icons for the nodes. )

 

 

Clicking on "Expand". The scroll bar is not showing the first items in the list. Maybe a bug with CS6?

At least a different behavior compared to InDesign CC.

 

 

Clicking "Collapse" again.

Note the difference to the initial screenshot with CS6. Another bug with CS6 maybe?

The connector between node 2 and 3 is indented too much.

 

I see no immediate solution to your problem.

Best report the issue at:

https://indesign.uservoice.com/

 

When done, please come back and post the link to your report so that we can vote for fixing the issue.

 

Thanks,
Uwe Laubender

( ACP )