Skip to main content
Trevor:
Legend
February 19, 2013
Answered

eventName for checkboxControls EventListener [UI]

  • February 19, 2013
  • 2 replies
  • 2619 views

Does any one know how to add an eventListener to a checkboxControl (not a checkbox)? I can't get a recognised event name.

Thanks

Trevor

This topic has been closed for replies.
Correct answer Jongware

Trevor,

There seem to be *no* supported events for CheckBoxControls. Compare, for example, Document -- the list of supported events (AFTER_ACTIVATE, AFTER_EXPORT, etc.) is listed right below the 'usual' properties of the Document class. I'd have to check what the original XML file says what type this list is; I think it was something like 'class-specific properties'.

Anyway, it may be all scriptable InDesign objects have the properties 'events' and 'eventListeners' and the methods 'addEventListener' and 'removeEventlistener', because they are all based on one common 'Generic_InDesign_Object'. The functions and properties are there, but ... of course every type of object should have its own list of events it can handle. After all, your checkbox would not profit from having a "BEFORE_SAVE_AS" event.

So, one may deduce events were added on a per-object type basis; and apparently Adobe did not think it was useful to add events to your checkbox control. And this may be because the "old style" dialogs are being phased out and replaced by the much more powerful ScriptUI.

2 replies

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
February 19, 2013

Trevor,

There seem to be *no* supported events for CheckBoxControls. Compare, for example, Document -- the list of supported events (AFTER_ACTIVATE, AFTER_EXPORT, etc.) is listed right below the 'usual' properties of the Document class. I'd have to check what the original XML file says what type this list is; I think it was something like 'class-specific properties'.

Anyway, it may be all scriptable InDesign objects have the properties 'events' and 'eventListeners' and the methods 'addEventListener' and 'removeEventlistener', because they are all based on one common 'Generic_InDesign_Object'. The functions and properties are there, but ... of course every type of object should have its own list of events it can handle. After all, your checkbox would not profit from having a "BEFORE_SAVE_AS" event.

So, one may deduce events were added on a per-object type basis; and apparently Adobe did not think it was useful to add events to your checkbox control. And this may be because the "old style" dialogs are being phased out and replaced by the much more powerful ScriptUI.

Trevor:
Trevor:Author
Legend
February 19, 2013

Hi Jongware,

Finally one of the big 4

I think that explains it very well.

Thanks

@ Vamitul

1) No, I just made do without the eventListner

2) Windows 7 (the screenshot came a bit mess up - my fault)

here's a better one

TᴀW
Legend
February 19, 2013

Hi Trevor,

A little insulting there for the rest of us trying to help you.

Especially when I answered your question in my previous post -- there is

no way of doing this with the InDesign DOM dialog object.

...

Jump_Over
Legend
February 19, 2013

Hi,

Wouldn't it be

checkbox.onClick = function ()

{...}

hope...

Trevor:
Trevor:Author
Legend
February 19, 2013

No.

That's one of the reasons I wrote "checkboxControl (not a checkbox)"

I should be able to use checkboxControl.addEventListener (eventType: string, handler: varies[, captures: bool=false])

But I can't get any event type to work.

TᴀW
Legend
February 19, 2013

what is a checkbox control?