2 Replies Latest reply on Jan 5, 2017 6:32 PM by Dick Kain

    Where is there a list of InDesign Event types?

    Dick Kain Level 1

      I am extremely frustrated trying to find a list of the event type names that I can use in creating an event handler for a dialog object. Where is it hidden?


      For example, I want to write a line like the following, which does work if I define a dialog not using the with hierarchy (which is used in all the Adobe-provided examples)


          dialogEventListener = myDialog.addEventListener('click',clickTest)


      I cannot figure out how to get something like this working when I define the dialog using the with hierarchy, when I get an error message that "click" is not an event type. So I need to find the list of event types that do work in this context. I have found references to the JavaScript Tools Guide, but there's nothing in there that lists event types.



        • 1. Re: Where is there a list of InDesign Event types?
          Marc Autret Level 5

          Here are some (all?) ScriptUI events we have discovered so far:


          Event Type (string)Handler Alias (if any)Target Widget(s)
          onDrawany [not an ‘actual’ event though, see documentation on DrawState object.]
          focusonActivate (Window only)various (Window, EditText, Button…)
          bluronDeactivate (Window only)various (Window, EditText, Button…)
          changeonChangevarious (EditText, Slider, Scrollbar, ListBox…)
          changingonChangingEditText, Scrollbar, Slider
          clickonClickButton, IconButton, Checkbox, RadioButton (maybe others)
          keyupEditText (maybe others)
          keydownEditText (maybe others)
          onShortcutKey (Windows OS only)Window
          onSelect (?)(Need more detail on this one…)
          onDisplay (?)(Need more detail on this one…)


          Note 1. — Event types (strings) involve addEventListener and then an actual event handler of your own that will (assumedly) behave as detailed in ECMA DOM Level-3 events, despite pitfalls and cross-platform issues. By contrast, the onXYZ aliases only partially capture the underlying events and shouldn't be considered equivalent to pure event handlers. There are many things you can only do using event listeners.


          Note 2. — Many great examples and additional info are exposed in ScriptUI For Dummies by Peter Kahrel: ScriptUI for dummies | Peter Kahrel




          • 2. Re: Where is there a list of InDesign Event types?
            Dick Kain Level 1

            Thanks for your table. I can contribute to the table in that I found that (1) click also works on groups and panels and (2) change does work on dropdowns. These work when the window stuff is created and structured in the style of Kahrel (which I had found earlier), but they don't work when you use the windows creation approach that is used in the  JavaScript Tools Guide, which is based on nested with clauses. Under that approach, it seems that you can't provide an interactive user experience, because you can't change the window's appearance in response to clicks. I had been trying to have things change in response to changes of selections in dropdown lists, which didn't work out. I do know that I can rework my window using the other approach, which involves more typing, as I noted in another thread here. A couple of years ago I finished a complicated Photoshop script under which the dialog box changed in response to dropdown selections, but the environment in Photoshop is not carried over to InDesign.


            In the Photoshop environment you can respond to clicks on dropdown lists, but apparently not in InDesign. Earlier today I found that I can work around the lack (in InDesign) of a click response for the dropdown, simply by putting a click response on the group that includes the dropdown - but the user does have to click next to the dropdown, not directly on top of it. And just now, writing this response, I tried change with the dropdown and it did activate the event handler, as I added under (2) above. So that's my solution after I rewrite my complex window specification -- lots more typing but it gives the user a better experience!


            So I guess I have to continue reworking the dialog specification so I can include some click responses... Tedious!


            I think your answer is not complete (as if there is such out there!), but I'll give you credit for a correct answer.