4 Replies Latest reply on May 22, 2012 2:58 AM by Andreas Jansson

    [CS5/JS/ScriptUI]: All contents is removed from tabbedpanel when showing alert box or other Window.

    Andreas Jansson Level 2

      When I open a new window (an alert box, another scriptUI window, or an old style InDesign dialog) from my non modal ScriptUI interface, the contents inside all tabs on the tabbedpanel of the window disappear completely, and the last tab is selected.


      Other controls, outside the tabbed panel (but in the same window) are left untouched.


      I suspect the error has to do with the tab control. I have been able to recreate the error in an extremely simple window, and I attach the code below.


      #targetengine 'test'
      var Window1 = new Window('palette','Test',undefined);
      function buildWindow(){
          Window1.tabMain = Window1.add('tabbedpanel',undefined,undefined);
          Window1.tabMain.minimumSize= [450,170];
          Window1.tabMain.Tab1 = Window1.tabMain.add('tab',undefined,"Tab 1");
          Window1.tabMain.Tab1.Static1 = Window1.tabMain.Tab1.add('staticText',undefined,"Text on tab 1");
          Window1.tabMain.Tab2 = Window1.tabMain.add('tab',undefined,"Tab 2");
          Window1.tabMain.Tab2.Static1 = Window1.tabMain.Tab2.add('staticText',undefined,"Text on tab 2");
          Window1.tabMain.Tab1.btnTest = Window1.tabMain.Tab1.add('button',undefined,"Test");
          Window1.tabMain.Tab1.btnTest.onClick = function(){alert('btnTest_onClick')};
          // Trying with calls to layout . (This button is not affected by the alert showing - only controls inside the tabbed panel)
          Window1.btnLayout = Window1.add('button', undefined, 'Window1.layout.layout()');
          Window1.btnLayout.onClick = function(){Window1.layout.layout()};


      The interface works well in CS4, and also if I make the window modal (by creating it as a "dialog").


      In CS5, the result is this:





      Calling layout.layout() or layout.resize() doesn't do anything.


      If someone else would like to try my code, do you get the same effect?

      Is the behaviour known?

      Is there a way to prevent this from happening for non modal ScriptUI windows?


      Best regards,

      Andreas Jansson