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

Contributor ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting , SDK

Views

212

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Mar 16, 2022 Mar 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();

Likes

Translate

Translate
Adobe Employee ,
Mar 15, 2022 Mar 15, 2022

Copy link to clipboard

Copied

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.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 15, 2022 Mar 15, 2022

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

 

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();

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 17, 2022 Mar 17, 2022

Copy link to clipboard

Copied

Great Idea!

 

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

Slider key handling - 1.gif

 

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

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

… resulting in:

Slider key handling - 2.gif

 

 

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 17, 2022 Mar 17, 2022

Copy link to clipboard

Copied

 

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.

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 17, 2022 Mar 17, 2022

Copy link to clipboard

Copied

That is, it will be possible to write not plugins, but separate scripts? (this is what most ordinary users count on, since the tasks of commercial development and daily automation often differ).

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 17, 2022 Mar 17, 2022

Copy link to clipboard

Copied

ExtendScript is being slowly phased out in favor of modern JavaScript UXP APIs.

By @erinferinferinf

 

That's excellent news!! Actually, that's what I was going to suggest, not being aware of the fact the UXP already existed.

 

My thought was the everything is at the ready already:

  1. Adobe products are all written in NodeJS
  2. on Windows a COM library already exists

 

So it should be easy (yet loads of work still) to create a NodeJS library binding based on COM on Windows for a start.

 

So, with UXP we can create a NodeJS project, require the appropriate Adobe library and then use all the tools there already are on the market for development for automating Adobe products? Did I get that right from this page?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

quote

So, with UXP we can create a NodeJS project, require the appropriate Adobe library and then use all the tools there already are on the market for development for automating Adobe products? Did I get that right from this page?

 

Oh no, did you find that page by googling UXP? Was that the top result? (Do you happen to remember your search terms? That's old documentation from an Alpha release. My team will have to update the header to let people know...

 

The UXP latest documentation is here: https://developer.adobe.com/photoshop/uxp/2022/

 

You can discuss UXP in this special developer forum here: https://forums.creativeclouddeveloper.com/

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

I may have found the resulting page on page #2, googling for "Adobe UXP". I guess I found the title "Photoshop JS API · Photoshop UXP (Alpha)" more inviting than "Documentation-UXP for Adobe Photoshop". – I think I believed the other document was about some "Documentation-UXP" rather than "UXP for Adobe Photoshop" ☺

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 21, 2022 Mar 21, 2022

Copy link to clipboard

Copied

LATEST

Thanks for pointing me to the updated location and to the forum!

I created a corresponding topic up there:

https://forums.creativeclouddeveloper.com/t/proposal-create-nodejs-binding/4447

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2022 Mar 17, 2022

Copy link to clipboard

Copied

keydown and keyup work same in ESTK and CS6, without delay. So is it Ps CC bug?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines