Script UI EditText behavior

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
Posts: 2
Joined: February 14th, 2019, 8:56 am

If I add an expression control Slider effect to a layer, the value of the slider appears as a link that you can either drag your mouse across to edit, or click to change it to an edittext- type field. When I add an edittext to a UI window, it's just the edittext field. I'm wondering if it's possible to mimic the expression control value behavior. I've looked through the ScriptUI For Dummies and the Javascript Tools Guide and can't figure out if it's possible. Not necessary, but it's a nice UI feature. Anybody have any idea if it can be done?
Posts: 16
Joined: December 8th, 2014, 11:11 pm

I think ScriptUI for Dummies has what you're looking for on page 70 under the slider section. Basically you add an edittext item and a slider item, and then connect them to update each other using the onChanging function. Here's the sample of code from Peter Kahrel's guide.

Code: Select all

var w = new Window ('dialog');
var value = w.add ('edittext {text: 0, characters: 3, justify: "center", active: true}'); 
var slider = w.add ('slider {minvalue: -50, maxvalue: 50, value: 50}'); 
slider.onChanging = function () {value.text = slider.value - 50} 
value.onChanging = function () {slider.value = Number (value.text) + 50};
Post Reply