Skip navigation
Currently Being Moderated

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

Oct 18, 2011 5:18 AM

Tags: #indesign_cs5 #scriptui #tabbed_panels #redraw #tabbedpanel #non-modal_windows

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);
buildWindow();
Window1.show();
 
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:

 

 

Tabbedpanel.png

 

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

 
Replies
  • Currently Being Moderated
    Oct 18, 2011 6:44 AM   in reply to Andreas Jansson

    Hey Andreas,

     

    This seems to me like a bug to me.

    It works for me in CS4 and CS5.5, but it doesn't in CS5.

    So, we can conclude that this is some really

    bad bug which was "introduced" in CS5 and fixed in CS5.5.

     

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

     
    |
    Mark as:
  • Currently Being Moderated
    May 16, 2012 11:36 PM   in reply to Andreas Jansson

    Accidentally I have found out that setting tabbedPanel selection explicitly right after alert prevents the bug

     

    Window1.tabMain.Tab1.btnTest.onClick = function(){alert('btnTest_onClick');Window1.tabMain.selection=Window1.tabMain.Tab1;};

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points