So it seems that ScriptUI Panels don’t receive layout events, under the 64-bit Windows version of CS5.5. A forum post I ran across has a few other people with this issue, and they report it affects After Effects, and Photoshop also. I was able to work around it a little, by calling the PanelObject.layout.layout() function. Unfortunately, it doesn’t help with resize events, but it’s better than manually typing in coordinates for controls.
Here’s a smidge of code that reproduces the issue. I filed a bug, hopefully it gets fixed. I’m spending a good deal of time working in the ExtendScript toolkit while doing post for Binary Samurai, and bugs don’t help!
[code lang=”js”]
var testPanel = createUI(this);
function createUI(thisObj) {
var win = (thisObj instanceof Panel) ? thisObj : new Window(‘palette’, ‘Test’, [100, 100, 300, 300]);
var row1 = win.add(‘group’, undefined);
var btnOne = row1.add(‘button’, undefined, ‘One’); btnOne.onClick = doOne;
var btnTwo = row1.add(‘button’, undefined, ‘Two’); btnTwo.onClick = doTwo;
var row2 = win.add(‘group’, undefined);
var btnThree = row2.add(‘button’, undefined, ‘Three’); btnThree.onClick = doThree;
var btnFour = row2.add(‘button’, undefined, ‘Four’); btnFour.onClick = doFour;
// Broken events in CS5 x64 – these don’t help! bug report filed…
win.addEventListener(‘show’, win.layout.layout);
win.addEventListener(‘resize’, win.layout.resize);
// Workaround. Lame.
win.layout.layout();
return win;
}
[/code]