PS2020. Script UI problem

  • 1
  • Problem
  • Updated 7 months ago
Run the script.

var font1 = ScriptUI.newFont("Arial", ScriptUI.FontStyle.REGULAR, 10);
var font2 = ScriptUI.newFont("Arial", ScriptUI.FontStyle.REGULAR, 18);

var d = new Window("dialog");

var l = d.add("listbox");
l.preferredSize = [500, 500];

l.graphics.font = font1;

for (var i = 0; i < 30; i++) l.add("item", "item item item item item item item " + i);

var b = d.add("button", undefined, "B1");
b.graphics.font = font2;

var b1 = d.add("button", undefined, "B2");
//b1.graphics.font = font2;

d.add("button", undefined, "Cancel");


b.onClick = function()
    {
    var d = new Window("dialog", l.itemSize);
    d.add("button", undefined, "Cancel");
    d.show();
    }

b1.onClick = function()
    {
    var d = new Window("dialog", l.itemSize);
    d.add("button", undefined, "Cancel");
    d.show();
    }


l.selection = 0;
l.active = true;

d.show();

If the size of font2 is greater than font1, we get a "jumping" list.

Press the B1 button. Close the popup.
Click sequentially in different lines of the list (at the top, in the middle, at the bottom).
Press the B2 button. Close the popup.
Click sequentially in different lines of the list (top, middle, bottom).

The distance between the lines of the list increases or decreases.

Is there a chance that this will be fixed?






Photo of r-bin

r-bin

  • 56 Posts
  • 8 Reply Likes

Posted 7 months ago

  • 1
Photo of David Converse

David Converse

  • 933 Posts
  • 270 Reply Likes
missing d.layout.layout(true);

I don't get why you would do this anyway.
Photo of r-bin

r-bin

  • 56 Posts
  • 8 Reply Likes
This is a simplified demo code.
Adding d.layout.layout (true) does not help.
Moreover, this function is automatically called before the onShow event.

Reproduces on both Mac and Windows