8 Replies Latest reply on Mar 4, 2015 7:33 AM by Andreas Jansson

    InDesign CC: ScriptUI TreeView broken

    Andreas Jansson Level 2

      Some troublesome news regarding the treeview in InDesign CC, ver. 9.0 (updated today through ).

       

      Using the treeview in "InDesign Creative Cloud" trees can no longer be built dynamically, since there are no plus signs for expanding, until children are added (and then it's too late).

       

      The onDoubleClick event also seems to be removed from the TreeView.

       

      Regarding building the tree dynamically, by loadning new nodes when clicking "+":

      In CS6 and before, the Node object always had a plus sign. If you clicked it, you could have an onExpand event hooked up, that added child nodes "on the run".

      If the node was not to be expanded ever (no plus sign) you added an "item" instead of a "node".

       

      In InDesign CC however, nodes without children are always shown without plus signs, making it impossible to load the children dynamically, since there is no way for the user to trigger an onExpand event. The nodes appear just as the items did in CS6. Here is a screen shot of a treeview, the same code running in CS6 (left) and InDesign Creative Cloud (right):

       

      CS6-vs-CC-same-code-window.png

       

       

      As you can see, the plus (or rather "turnable triangular things" in the dark and cool new super UI of CC) are missing in CC.

       

      Here is the code (which also demonstrates that the onDoubleClick event no longer works, double click a node text in CS6, and the message "Doubleclick will appear", in CC no message appears when double clicking a node):

       

      #targetengine 'testengine1'
      var Window1 = new Window('palette','My window');
      buildWindow();
      Window1.show();
      
      var nodeDoubleClickHandler = function(){
          alert('Doubleclick')
      }
      var nodeExpandHandler = function(item){
              alert(item.text);
      }
      
      function buildWindow(){
          
          Window1.Treeview1 = Window1.add('treeview',undefined,undefined);
          Window1.Treeview1.onExpand = nodeExpandHandler;
          Window1.Treeview1.onExpand = nodeDoubleClickHandler;
      
          Window1.Treeview1.Node1 = Window1.Treeview1.add('node',"Node 1 (node)");
          Window1.Treeview1.Node2 = Window1.Treeview1.add('node',"Node 2 (node)");
          Window1.Treeview1.Node3 = Window1.Treeview1.add('item',"Node 3 (item)");
      
      }
      
        • 1. Re: InDesign CC: ScriptUI TreeView broken
          Marc Autret Level 4

          I suggest the creation of a sticky topic "What is broken in ScriptUI CC"—because we'll have to face MANY threads in that field

          • 2. Re: InDesign CC: ScriptUI TreeView broken
            Andreas Jansson Level 2

            I agree, but I can't do that myself, right?

             

            Do you think Adobe will consider this a bug? It will surely render many user interfaces useless, so I really hope so... but reading the documentation strictly, neither "plus" for nodes without children nor doubleclick for the treeview is mentioned (I'd be happy to be proven wrong on that statement though!).

             

            Off topic: Since these are my first impressions of InDesign Creative Cloud, you can understand that they are not good. And also I don't like the idea of not being able to buy the program, just "rent" it (I just had to say it... completely off topic), and I don't understand what they will do to the developer partnerships, "12 months"... and then what?

            • 3. Re: InDesign CC: ScriptUI TreeView broken
              Marc Autret Level 4

              > Do you think Adobe will consider this a bug?

               

              I don't know. My overall feeling is that Adobe does not care about ScriptUI, as their goal is ostensibly to lead us to ExtensionBuilder. I think ScriptUI CC has not been properly connected to the new skin API. Some examples: you cannot change ScriptUI fonts (at least for the time being); the invokePlayerFunction() of the FlashPlayer widget is broken; many events and listeners such as 'focus' or 'onDraw' not work as they did (or are simply discarded); the layout manager 'stack' orientation now causes weird problems; panels with {borderless:true} creation property are not borderless; other widgets don't support ScriptUIPen and ScriptUIBrush customization anymore; and so on.

               

              The key fact is that ScriptUI CC now operates in a new workspace, "Drover" (cf. ScriptUI.frameworkName) which—I think—does not communicate with the OS look-and-feel API as it was done up to now. Instead, that workspace interacts with Adobe CC own skins (cf. GeneralPreference.uiBrightnessPreference in the scripting DOM) which is probably based on Flash and/or HTML5 technologies, giving rise to new limitations at the ScriptUI level.

               

              Well, that's just my theory so far. (I need to investigate further.)

               

              @+

              Marc

              • 4. Re: InDesign CC: ScriptUI TreeView broken
                Andreas Jansson Level 2

                First one correction: The double click event of the treeview does work. It's just an error in my code. Change

                Window1.Treeview1.onExpand = nodeDoubleClickHandler;

                into

                Window1.Treeview1.onDoubleClick = nodeDoubleClickHandler;

                 

                But the main problem remains, building the tree "on the run" (i.e. adding subnodes when expanding the parent node).

                I'm adding some more information and sample code below. Perhaps someone else can figure out some kind of workaround.

                Just adding a "dummy node" under every node that should be expandable, is a simple solution just to show the expansion symbols to the left of the root nodes.

                The expand event is triggered when opening a node on the root level, but adding new nodes, inside the "expand handler" function, does not work... Well, the nodes might be added, but the treeview seems to redraw automatically and collapse the "item" node (the one that was expanded), so that the new nodes are immedieately hidden from view.

                 

                 

                #targetengine 'testengine1'
                var Window1 = new Window('window','My window');
                buildWindow(Window1);
                Window1.show();
                
                var nodeDoubleClickHandler = function(){
                    if (this.selection) alert(this.selection.text); // The name of the selected node.
                }
                var nodeExpandHandler = function(item){
                    var newName = String.fromCharCode(item.text.charCodeAt(0) + 1) ;  // Generate name ("B" node will be added under the "A" level node, for example)
                    item.add("node", newName); // Add the new node as a subnode to the item being expanded.
                }
                
                
                function buildWindow(win){
                
                    win.Treeview1 = Window1.add("treeview");
                    win.Treeview1.preferredSize.height = 300;
                    win.Treeview1.preferredSize.width = 300;
                
                    win.Treeview1.Node2 = Window1.Treeview1.add("node","A");
                    win.Treeview1.Node2SubDummy = Window1.Treeview1.Node2.add("node","Dummy for CC to show an expand symbol");
                
                    win.Treeview1.onExpand = nodeExpandHandler;
                

                }

                 

                Results, in CS6 to the left and CC to the right:

                CS6 and CC treeviews result.PNG

                 

                The "A" node just keeps collapsing in CC.

                 

                Suggestions?

                • 5. Re: InDesign CC: ScriptUI TreeView broken
                  Loic.Aigon Adobe Community Professional

                  Hi all,

                   

                  I am just constating the same trouble right now. Adding nodes and items dynamically will not expand the nodes even if the expanded property is set to true.

                   

                  Very painful and hopeless.

                   

                  Loic

                  http://www.ozalto.com

                  • 6. Re: InDesign CC: ScriptUI TreeView broken
                    Andreas Jansson Level 2

                    After waiting a long time for Adobe to fix this, asking them about progress on this bug every other month or so, I was eventually recommended to rewrite the whole user interface as HTML/CEP.

                    • 7. Re: InDesign CC: ScriptUI TreeView broken
                      Loic.Aigon Adobe Community Professional

                      Hi Andreas

                      Yeah that seems to be the course of History no matter what. But it's also meaning adressing our products/scripts to CC users only. What if a client is on CS5, CS6 even CS4 ? I know I am stating the obvious here but ScriptUI is (was) an answer for a far larger community at least until now. I guess that in 10 years from now, everyone will be working with CC versions and this debate won't be valid anymore.

                      Thanks for your feedback, it confirms what I have heard elsewhere ScriptUI is dead.

                      Loic

                      • 8. Re: InDesign CC: ScriptUI TreeView broken
                        Andreas Jansson Level 2

                        We've got the same problem as you, most customers using CS4 to CS6.

                        I hope to be able to use the same main code for both user interfaces. I've kept the ScriptUI inside the jsx file, while adding the new CEP/HTML in a separate file, and adapted functions in the jsx to manage requests from the new HTML and JS files.

                        I'm not done yet, but I hope to be able to start the old interface with the jsx only, but to begin with I have just focused on getting the HTML version to work.

                         

                        There are a few bugs in ScriptUI for CC, so it's strange that Adobe doesn't fix them. Ever from the treeview bug was detected and opened in June 2013 until a year later they "escalated" the bug and told me that "hopefully we will get a fix soon", and "Again I’m very sorry for this, a bug should not be open so long time with us".

                        But last summer (2014) the responsible people  began to suggest that I built a new user interface, and a couple of months ago I gave up on waiting for a bug, since there are a couple of customers who want to use CC.

                        It's hard to make an interface that looks quite as integrated as with ScriptUI when using HTML.

                         

                        Below the kind but somewhat unsatisfactory answer from Adobe, June 2014:

                         

                        "[...] I’m afraid that there’s not a fix for this yet, however I can with you some more detail on the scope of the problem. The change in behaviour was a side effect of some of the changes to the UI architecture for the CC release. It appears that AfterEffects also suffers from this issue and the engineering teams are reviewing if this can be fixed.

                         

                        I’m sorry that we can’t commit any timelines for a fix, however, in the meantime there is the alternative of using Extension Builder to create the UIs for your scripts. [...]"


                        It would still be interesting to find out what the review from the "engineering teams" found out, and their conclusion.