3 Replies Latest reply on Mar 10, 2014 3:23 PM by Loic.Aigon

    ScriptUI Layout issue

    Loic.Aigon Adobe Community Professional

      Hi all,


      Our old friend ScriptUI is driving me nuts with its LayoutManager…Maybe you will have some thoughts about it.


      Given a group which alignChildren property is set to "["fill","fill"]; This group is actually hosting several children including a button. As it, th childrn ar smoothly resizd to take all the space available :


      Capture d’écran 2014-03-08 à 01.14.22.png


      However, the button is HUGE which is normal at this stage. Now I want to reduce it to a "normal" size. So I am setting the minimumSize and maximumSize property of the button to 45 pixels wide. I would expect that teh button is reduced and the other components expanded regardingly. But it's not what happens. Indeed, the button is well resized but the children no longer takes all space available.


      Capture d’écran 2014-03-08 à 01.14.51.png


      I am a bit confused here. Anyone can see what's going on ? I am joining a sample script anyone can try : http://dl.free.fr/fJTkudDzk

      Just un/comment this line to switch between those two states :


      browseGlobalSrcBtn.maximumSize.width = browseGlobalSrcBtn.minimumSize.width = 45;


      Thanks in advance for any hint,



        • 1. Re: ScriptUI Layout issue
          Trevorׅ Adobe Community Professional

          Hi Loic,


          As far as I know "fill"  if only really effective if there is only child in the group, in which case that child will fill it's parent but as soon as the group has more than one child to it  the the layout engine will fail (It would be difficult for it to pass).


          In such a case you have to give it guidelines, in your case if you get rid of the w.minimumSize.width = 600; line and replace the last lines with the following then things get much more into order.  In other cases thing can get a lot more complicated.



          browseGlobalSrcBtn.maximumSize.width = browseGlobalSrcBtn.minimumSize.width = 45;
          globalSrcSt.maximumSize.width = globalSrcSt.minimumSize.width = 372;
          var p = w.add('panel');
          globalDestGp.children[0].maximumSize.width = globalDestGp.children[0].minimumSize.width = globalSrcLabel.maximumSize.width =globalSrcLabel.minimumSize.width =globalSrcLabel.preferredSize.width; // = 100;
          globalDestSt.minimumSize.width = globalDestSt.maximumSize.width = globalSrcSt.maximumSize.width +  browseGlobalSrcBtn.maximumSize.width + globalSrcGp.spacing;





          • 2. Re: ScriptUI Layout issue
            Trevorׅ Adobe Community Professional

            P.s. The Layout engine bases itself on preferred sizes so even if you set the button size to 45 the preferred size will stay at 80. That's ok but even if one set the preferred size to 45 it will get reset to 80 so the group size will be set to fill the 80 size, this is because priority is given to the "fill" instruction and because the panel is set to fill thing get messed up.


            browseGlobalSrcBtn.maximumSize.width = browseGlobalSrcBtn.minimumSize.width = browseGlobalSrcBtn.preferredSize.width =  45;


            Result: button { text:...,bounds:434,0,479,22,location:434,0,maximumSize:45,1110,minimumSize:45,0,preferre dSize:80,22,size:45,22,textDirection:null }


            Marc has a flow chart on this topic but I can't remember what it say's, you can find it on his site

            • 3. Re: ScriptUI Layout issue
              Loic.Aigon Adobe Community Professional

              Hi Trevor,


              Thanks a lot for the feedback. Very appreciated. I was used to the Flex Layout engine taking care of all these stuff in a blink