1 Reply Latest reply on Nov 14, 2017 2:37 AM by r-bin

    Change statictext length dynamically

    Zeeto Level 1

      Hello,

       

      Is there a way of changing the statictext length in scriptui after the window is displayed?

      I'm trying to do something like below:

       

      Sometext                       = win.add('statictext', undefined, 'Hello World');
      Button                         = win.add('button {text: "Change"}')
      Button.onClick = function()
      {
           van newText               = 'This is considerably longer text than Hello World which I would like to see in whole';
           Sometext.characters       = newText.length;
           Sometext.text             = newText;
           win.layout.layout(true);
      }
      
      win.show();
      
        • 1. Re: Change statictext length dynamically
          r-bin Level 5

          // Try this

           

          var d = new Window("dialog", "");

           

          var t = d.add("statictext", undefined, "1234");

          t.preferredSize.width = 300;

           

          var b = d.add("button", undefined, "test")

           

          b.onClick = function ()

              {

              try {

                  t.size.width = 20;

           

                  // d.layout.layout(true); // resizes d always

                  // d.layout.resize();     // resizes d if t does not fit in d

                  }

              catch(e) { alert(e); }

              }

           

          d.show()

          1 person found this helpful