Skip to main content
KlausKi
Inspiring
March 13, 2022
解決済み

Slider control doesn't fire onChanging event when manipulated through cursor keys

  • March 13, 2022
  • 返信数 2.
  • 1593 ビュー

The slider control can be updated, when it has focus, by pressing LEFT ARROW or RIGHT ARROW keys.

But when I do, no onChanging() events are fired. Nor is the onChange() event when I hit TAB to move on to another control.

 

This seems to be an accessibility issue.

このトピックへの返信は締め切られました。
解決に役立った回答 jazz-y

 

var w = new Window("dialog"),
    slider = w.add("slider {minvalue:0, maxvalue:100, value:50, preferredSize:[500,-1] }");
slider.onChanging = function () { w.text = this.value }
slider.addEventListener('keyup', function () { slider.onChanging() })
w.show();

 

返信数 2

jazz-y解決!
Legend
March 16, 2022

 

var w = new Window("dialog"),
    slider = w.add("slider {minvalue:0, maxvalue:100, value:50, preferredSize:[500,-1] }");
slider.onChanging = function () { w.text = this.value }
slider.addEventListener('keyup', function () { slider.onChanging() })
w.show();

 

KlausKi
KlausKi作成者
Inspiring
March 17, 2022

Great Idea!

 

Just a minor flaw: The text doesn't get updated before relasing the key:

 

So, I used "keydown" instead of "keyup" event:

slider.addEventListener('keyup', function () { slider.onChanging() })

… resulting in:

 

 

However, I suggest this line to become intrinsic to the Slider control itself, for it to behave like this regardless of whether an ExtendScript programmer may have missed to implement it himself.

erinferinferinf
Adobe Employee
Adobe Employee
March 17, 2022

 

However, I suggest this line to become intrinsic to the Slider control itself, for it to behave like this regardless of whether an ExtendScript programmer may have missed to implement it himself.


It's unlikely this will get get fixed; ExtendScript is being slowly phased out in favor of modern JavaScript UXP APIs (over several years). UXP scripting capability is coming to Photoshop this year.

 

 

erinferinferinf
Adobe Employee
Adobe Employee
March 15, 2022

Hi @KlausKi,

 

Coding Corner is probably not the best place to get a response to this question. In order to move your question to the appropriate place, I need to know:

 

  • Which app or apps are you using this in? (InDesign? Photoshop? Both?)
  • Which API or SDK are you using? CEP? ... or is this a script?
  • Where did you get your slider code? Or did you write it?

 

From the question, without much context, I'm guessing it's a CEP panel. Keyboard shortcuts for those only work with the panel is in focus, unless you add in some C++ elements.

 

 

KlausKi
KlausKi作成者
Inspiring
March 15, 2022

Thanks, @erinferinferinf, for taking the time!

 

I'm actually using the Photoshop "Image Processor" script ("C:\Program Files\Adobe\Adobe Photoshop 2022\Presets\Scripts\Image Processor.jsx") as a base for my own script. The code therein is pretty much my code, too.

 

I'm not sure about which SDK the slider is residing in. I guessed it is a core SDK component?

erinferinferinf
Adobe Employee
Adobe Employee
March 16, 2022

Ah-hah!

 

In that case, the Photoshop forum's Scripting tag will be the best place to get a response. I've moved your post and added the tags.