Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Aligning Buttons In A Row

Contributor ,
Oct 22, 2018 Oct 22, 2018

On my Form I have 4 buttons on a Row. The only way I can get them to show as below is to space them by using some statictext

add("statictext", undefined, "").preferredSize.width = 320;

Is this the normal way of doing something like this ?

Screenshot 2018-10-22 at 14.48.24.jpg

with (myForm.add("group"))

            {

            orientation = "row";

            alignment = "right";

            margins = 0;

            spacing = 10;

          

            var button3 = add("button", undefined, "About");

            var button4 = add("button", undefined, "Help");

            button4.enabled=false;

            add("statictext", undefined, "").preferredSize.width = 320;

            var button1 = add("button", undefined, "OK");

            var button2 = add("button", undefined, "Cancel");

          }

TOPICS
Actions and scripting
536
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Contributor ,
Oct 22, 2018 Oct 22, 2018

You will need to group them, then align.

var w = new Window ('dialog', "test");

w.orientation = "row";

w.preferredSize.width = 1000 // set value for total width of dialog

var g1 = w.add ("group", undefined)

var g2 = w.add ("group", undefined);

g1.alignment = ["fill", "left"];

g2.alignment = ["fill", "right"];

var btn1 = g1.add ("button", undefined, "Group 1, button 1");

var btn2 = g1.add ("button", undefined, "Group 1, button 2");

var btn3 = g2.add ("button", undefined, "Group 2, button 3");

var btn4 = g2.add ("button", undefined, "Group 2, button 4");

w.show()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2018 Oct 22, 2018

Put them in a group and adjust the alignment for the left side and the right side:

#target photoshop

var dlg = new Window('dialog','button test');

    dlg.size = [800,50]

    dlg.gp = dlg.add('group');

    dlg.gp.orientation = 'row';

    dlg.gp.alignment = ['fill','top']

    dlg.gp.aboutBtn = dlg.gp.add('button',undefined,'About')

    dlg.gp.aboutBtn.alignment = ['left','top'];

  

    dlg.gp.helpBtn = dlg.gp.add('button',undefined,'Help')

    dlg.gp.helpBtn.alignment = ['left','top'];

  

    dlg.gp.okBtn = dlg.gp.add('button',undefined,'OK')

    dlg.gp.okBtn.alignment = ['right','top'];  

  

    dlg.gp.cancelBtn = dlg.gp.add('button',undefined,'Cancel')

    dlg.gp.cancelBtn.alignment = ['right','top'];      

  

    dlg.show()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 23, 2018 Oct 23, 2018
LATEST

Thank You, fully appreciated

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines