title: Change UI size based on statictext Extendscript
body: <p>I have the following code:</p>
  
  <pre><code>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";
  }
  </code></pre>
  
  <p>How can I force the window size(or textgroup size), to fit the new text size while I add new lines to the text?</p>