根据statictext Extendscript更改UI大小

问题描述 投票:0回答:1

我有以下代码:

var win = new Window('palette');
var textGroup = win.add("group");
var text = textGroup.add("statictext{text:''}");
var button = textGroup.add("button{text: 'Add text'}");

button.onClick = function()
{
    text.text += "new line\n";
}

在向文本添加新行时,如何强制窗口大小(或文本组大小)以适应新的文本大小?

javascript extendscript
1个回答
0
投票

最后我发现了如何,我需要调整文本大小然后调用window layout():

button.onClick = function()
{
    text.text += "new line\n";
    text.size.height += text.graphics.font.size;
    text.window.layout.layout(true)   
}
© www.soinside.com 2019 - 2024. All rights reserved.