Skip to main content
TᴀW
Legend
May 31, 2012
Question

Menu Actions: eventType question. JS

  • May 31, 2012
  • 1 reply
  • 4061 views

Hi,

(1) How would I add an eventListener for a given menu action that kicks

in when the menu is dismissed?

Eg

myMenuAction.addListener("onInvoke", function(){alert("Hello");});

adds a listener when it is invoked. But what would be the eventType for

"dismiss"?

(2) Where are the list of eventTypes documented?

Thanks,

Ariel

This topic has been closed for replies.

1 reply

John Hawkinson
Inspiring
May 31, 2012

Menus don't get dismissed. They get invoked.

Do you mean a panel or a dialog or a window?

There's afterInvoke and of course you can queue an idle event handler and ON_IDLE.

I guess that means my answer to your List of Eventtypes question is a bad one:

>> Event.reflect.properties.sort().join("\n")

AFTER_ACTIVATE

AFTER_CLOSE

AFTER_CONTEXT_CHANGED

AFTER_DELETE

AFTER_EMBED

AFTER_INVOKE

AFTER_LINKS_CHANGED

AFTER_MOVE

AFTER_NEW

AFTER_OPEN

AFTER_PLACE

AFTER_QUIT

AFTER_SELECTION_ATTRIBUTE_CHANGED

AFTER_SELECTION_CHANGED

AFTER_UNEMBED

AFTER_UPDATE

AT_TARGET

BEFORE_CLOSE

BEFORE_DEACTIVATE

BEFORE_DELETE

BEFORE_DISPLAY

BEFORE_EMBED

BEFORE_INVOKE

BEFORE_MOVE

BEFORE_PLACE

BEFORE_QUIT

BEFORE_UNEMBED

BEFORE_UPDATE

BUBBLING_PHASE

CAPTURING_PHASE

NOT_DISPATCHING

ON_INVOKE

__proto__

arguments

arity

length

name

prototype

prototype

since it doesn't include many kinds of events. Like IdleEvent.ON_IDLE.

So I guess you have to look at all the types that end in Event, like Event, IdleEvent, MutationEvent, etc., and enumerate them.

Bah.

TᴀW
TᴀWAuthor
Legend
May 31, 2012

Thank you John, that's very helpful.

Still, not managing to get anything to work except "onInvoke".

For instance, thinking about the quick apply menu, I'd like to add a

listener after it is closed/hidden/dismissed or whatever the term would be.

But

app.menuActions.itemByID(18771).addEventListener("AFTER_CLOSE",

function(){alert("hello")});

...does nothing.

Ariel

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
John Hawkinson
Inspiring
May 31, 2012

Still, not managing to get anything to work except "onInvoke".

For instance, thinking about the quick apply menu, I'd like to add a

listener after it is closed/hidden/dismissed or whatever the term would be.

Again, that's because menus don't get dismissed.

They merely get invoked.

The Quick Apply panel is not a menu.

I don't think there is anywhere you can attach an event for this.

What is your actual goal?