1 Reply Latest reply on Nov 13, 2014 12:19 PM by xbytor2

    Adding options to a button?

    gespinha Level 1

      I've got the following code:

      obj = w.add('panel', [45,50,350,135], 'Title');
      

      How do I add options, such as size, margins, alignChildren to this panel?

      If I would do this in Script UI I'de do something like this:

      var layout = "dialog {  \
          text: 'Title',  \
          orientation: 'column', \
          alignChildren: ['fill', 'top'],  \
          preferredSize:[340, 135], \
          margins: 15, \
          \
              calculator: Panel { \
                  text: 'Sub-Title', \
                  orientation: 'row', \
                  alignChildren: 'fill', \
                  margins: 15, \
              } \
          }",
      

       

      But since I'm developing for Photoshop CC 2014, I can't use this syntax.

        • 1. Re: Adding options to a button?
          xbytor2 Level 4

          You can pass in the needed Creation Properties like this:


          obj = w.add('panel', [45,50,350,135], 'Title', { alignChildren : 'fill',  orientation : 'row', margins : 15 } ); 


          or (probably) set them manually like this:


          obj = w.add('panel', [45,50,350,135], 'Title');

          obj.alignChildren = 'fill';

          obj.orientation = 'row';

          obj.margins = 15;