Copy link to clipboard
Copied
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 ?
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");
}
Copy link to clipboard
Copied
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()
Copy link to clipboard
Copied
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()
Copy link to clipboard
Copied
Thank You, fully appreciated
Find more inspiration, events, and resources on the new Adobe Community
Explore Now