• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Catching "menu" invokation on UI icons (if only possible)

Valorous Hero ,
Jan 19, 2023 Jan 19, 2023

Copy link to clipboard

Copied

Hi Guys,

At the bottom of the pages panel, are two UI icons that I am interested in : 

LoicAigon_0-1674167057764.png

The button to add a page and the button to remove pages

I tried to identify the menu actions that could be used when the user clicks on those icons but I am simply not sure we can use menuactions here. I am afraid they are just hard coded.

 

Am I wrong? Anyone has succeeded in catching those click events with scripting?

Hopefully, someone can prove me wrong.

 

Loic

 

TOPICS
Scripting

Views

115

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

Guide , Jan 19, 2023 Jan 19, 2023

Hi Loïc,

 

Indeed the Create new page button seems independent from the menu action system (and that's probably the case of many UI buttons). Well, buttons are not menu items after all. We know there are exceptions to this rule, but I suspect they mostly apply to buttons which in fact embed contextual menus… [only a hypothesis though]

 

Regarding page add/insert/move/delete/etc, I guess you already know that the Layout > Page branch provide actual menu items and menu actions that can be intercepted,

...

Likes

Translate

Translate
Guide ,
Jan 19, 2023 Jan 19, 2023

Copy link to clipboard

Copied

Hi Loïc,

 

Indeed the Create new page button seems independent from the menu action system (and that's probably the case of many UI buttons). Well, buttons are not menu items after all. We know there are exceptions to this rule, but I suspect they mostly apply to buttons which in fact embed contextual menus… [only a hypothesis though]

 

Regarding page add/insert/move/delete/etc, I guess you already know that the Layout > Page branch provide actual menu items and menu actions that can be intercepted, e.g. app.menuActions.itemByName("$ID/Add Page"), and so on. Both beforeInvoke and afterInvoke event types are then available so you can attach event listeners there. But obviously that's not what you're looking for, since your goal is to spy add/delete events regardless of how the user initiated these actions 😉

 

[Ça sent l'idleTask, non?]

 

Best,

Marc

 

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
Valorous Hero ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

Hi @Marc Autret and thanks for your answer 😉

 

Thanks for confirming my doubts. Using idleTasks was my first shot but I came back to specific event listeners as they offered a more specific and reactive event mechanism. But I guess, my mistake was to ask too much in the event handler tied to the idleTask listener and I wasn't satisfied by the global behaviour.

If I set a larger delay, behaviour was better but reactivity decreased. If I set small delay, then it was a bit too expensive.

I think I will use idleTaks to monitor if there was any changes in the pages collection and run my main routines only if needed. 

I guess there is no other choices anyway 😬

 

Thanks again,

Loic

 

PS: Non mais t'as vu l'heure ! 😂

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
Valorous Hero ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

LATEST

So, by combining idleTasks, menuActions listeners and some app events, I got the perfect behaviour 😛

 

Thanks for the input @Marc Autret 

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