Copy link to clipboard
Copied
I have several sample scripts from the default installation that include the 'EditNumber' control for UI elements. Does any one have the definition of this control? I see the definition of EditText in the JavaScript UI docs but nothing on EditText
Thanks
Dean
Copy link to clipboard
Copied
EditNumber was first time found on this forum on Mar, 5, 2020, but for some reason posts about are removed from this thread: How does one make a Scriptui dialog or palette resizeable?
Ps. could you link us to scripts that contain 'EditNumber'?
Copy link to clipboard
Copied
For example Image Processor.jsx from
C:\Program Files\Adobe\Adobe Photoshop 2020\Presets\Scripts
a copy of which:
Copy link to clipboard
Copied
EditNumber was introduced some time later after EditText, and it reacts for numbers only.
Copy link to clipboard
Copied
Thanks, that is a pretty sweet option and also a short change (edittext to editnumber). I may make another version so that floats are easily input. I'll also look at adding a simple regex to strip out any decimal values, unless you can suggest another way to enforce integer input apart from using the numeric keydown event?
Copy link to clipboard
Copied
+String(123.456).split(/(?:\.\d+$)/)
or:
~~123.456
Copy link to clipboard
Copied
Hmmm... I would have done a replace rather than split, but the regex achieves the same end as I would have used.
However, the ~~ double tilde has raised my interest...
EDIT: Thank you, I am happy with using the "double NOT Bitwise operator" or Math.floor() in conjunction with EditNumber!