6 Replies Latest reply on Jan 3, 2017 10:25 AM by Dick Kain

    Is it true that you have to choose a specific approach to defining a user interface to get onChange to be available?

    Dick Kain

      I have been trying to get user interaction within a dialog box through the use of onChange to activate an event handler piece of code. I defined the window by using with clauses to add rows and columns. But I cannot find anything that reacts to clicks or choices that is also acceptable - I always get the response that the object (which was a dropdown list) does not support the "on" choice, whatever I try in that spot. That portion of the code looks like



                myDropDown = dropdowns.add(.....)

                myDropDown.onChange = function(){


      and so forth. I also tried onClick in there, with the same results.


      I see that there is another possibility - adding an event listener, but I cannot find any examples of how that works and whether that would work in the "with" dialog box structure. I don't see any events that have to do with user interaction in the events list that I found.


      When I wrote Photoshop scripts a couple of years ago, I used code like the snippet above, but I had constructed the dialog object by assigning names, etc. to all the elements, including the rows and columns and never using the "with" method to specify the structure of the dialog. In that context I had no problem with adding in event handlers. So, the question is -- do I have to recode the structure of the dialog to avoid the "with" items in order to get event handlers to be recognized as valid possibilities?


      Thanks in advance for help - I could rewrite the dialog specification, but if there's another way to get this done that is simpler, I'm open to trying anything that's simpler than rewriting my whole UI specification.