2 Replies Latest reply on Feb 3, 2012 10:53 AM by bduffy323

    Dynamic script UI changes

    bduffy323 Level 1

      pc and mac using CS 5.5.


      I was wondering if it was possible to have a UI that can change its appearance when a button is selected. For instance I would like to add a panel to the palette when they select a "turn on filter" button that will display some text boxes and radio buttons that will filter a list. Then if they select the "turn off filter" button I would like to remove the panel that holds all the filter fields and resize the window back to its original size. I've tried a combination of this.layout.layout() and this.layout.resize() after hiding the filter panel, but none seem to resize my palette,  it just leaves a gap where the panel was. The only way I can get it to work is to completely redraw the window but it takes too long due to the long list containted in the list box. Any ideas?

        • 1. Re: Dynamic script UI changes
          Marc Autret Level 4

          As I already suggested you can change the maximumSize property before win.layout.layout(1) to live-resize your UI.

          Here is a simple example:



          #targetengine 'testShowHidePanel'
          var NULL_SIZE = [0,0],
              MAX_SIZE = [1000,1000];
          var u,
              w = new Window('palette'),
              // ---
              p1 = w.add('panel'),
              c1 = p1.add('checkbox', u, "My checkbox1"),
              e1 = p1.add('edittext', u, "Edit text1"),
              // ---
              p2 = w.add('panel'),
              c2 = p2.add('checkbox', u, "My checkbox2"),
              e2 = p2.add('edittext', u, "Edit text2"),
              // ---
              b = w.add('button', u, "Show filter");
          p2.visible = false;
          p2.maximumSize = NULL_SIZE;
          b.onClick = function()
              p2.maximumSize = p2.visible ? NULL_SIZE : MAX_SIZE;
              b.text = (p2.visible ? "Show" : "Hide") + " filter";
              p2.visible ^= 1;




          • 2. Re: Dynamic script UI changes
            bduffy323 Level 1

            That worked just as you described. Thank you. By any chance would you know if it is possible to create a multicolumn listBox that contains images and populate it on creation?



            Thanks again!


            Message was edited by: bduffy323