Skip to main content
Inspiring
September 12, 2014
Answered

Possible to interact with checkbox in a custom menuitem?

  • September 12, 2014
  • 1 reply
  • 534 views

Is there any way to allow custom menu items to be checked (like the menuitems in the Windows menu can be)? The 'checked' property is read-only, for the menu item and the menu action, so I guess I'm wondering if there are any known workarounds or if this is a case of readonly meaning readonly. Thanks!

This topic has been closed for replies.
Correct answer Jongware

Browsing through menu related stuff in the DOM lead me to nothing, but Google turned up this blog entry by Harbs: http://in-tools.com/article/scripts-blog/showing-text-formatting-overrides/

-- and then I could find it in the DOM, well hidden:

Adobe InDesign CS6 (8.0) Object Model JS: ScriptMenuAction

So it seems you have to set the state of a menu action. The action in itself can be attached to one or more menus (MenuAction, where checked is read-only, is a parent class of ScriptMenuAction, and there it is read/write), probably to ensure that if a certain menu item appears in more than a single menu, they are all "updated" at the same time.

Harbs' example always sets 'checked = false' and changes the menu text to indicate its current state, but I assume one can also toggle the checked state.

1 reply

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
September 12, 2014

Browsing through menu related stuff in the DOM lead me to nothing, but Google turned up this blog entry by Harbs: http://in-tools.com/article/scripts-blog/showing-text-formatting-overrides/

-- and then I could find it in the DOM, well hidden:

Adobe InDesign CS6 (8.0) Object Model JS: ScriptMenuAction

So it seems you have to set the state of a menu action. The action in itself can be attached to one or more menus (MenuAction, where checked is read-only, is a parent class of ScriptMenuAction, and there it is read/write), probably to ensure that if a certain menu item appears in more than a single menu, they are all "updated" at the same time.

Harbs' example always sets 'checked = false' and changes the menu text to indicate its current state, but I assume one can also toggle the checked state.

cchimiAuthor
Inspiring
September 12, 2014

Thank you! (and thanks Harbs). That did it. Didn't dig deep enough, dagnabbit.