Copy link to clipboard
Copied
I'm trying to grab a number from the user, default of 1, with buttons next to it that increase or decrease that number
I don't believe I'm even close yet, the number displayed in the UI doesn't change here, also, I'm not sure it's even a number, but text instead. I'm still very new at this, everything is probably pretty crude.
w = new Window('dialog', "Gadget");
w.grp1 = w.add('group');
w.grp1.orientation = "row";
w.grp1.alignment = "right";
w.grp1.add("statictext", undefined, "Left Offset:");
var leftoffset = w.grp1.add("edittext", undefined, 1);
leftoffset.characters = 3;
leftoffset.active = true;
var grp1up = w.grp1.add("button", undefined, "+");
grp1up.onClick = leftoffset = leftoffset + 1;
var grp1down = w.grp1.add("button", undefined, "-");
grp1up.onClick = leftoffset = leftoffset - 1;
Another later goal is to have a checkbox in the UI near the beginning, that allows the button presses to increase the numbers by 0.25's instead of 1's
Your onClick code has to be revised to be set to a function like this:
grp1up.onClick = function(){
leftoffset.text = (leftoffset.text * 1) + 1;
}
the * 1 is to turn the string from UI into a number you can calculate with.
Copy link to clipboard
Copied
Your onClick code has to be revised to be set to a function like this:
grp1up.onClick = function(){
leftoffset.text = (leftoffset.text * 1) + 1;
}
the * 1 is to turn the string from UI into a number you can calculate with.
Copy link to clipboard
Copied
this board hasn't failed me once
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more