Submenu Item on Edit Context Menu



  • I’m trying to edit contextmenu.xml to modify the Edit Popup ContextMenu. I want to add the “Sort Lines Lexicographically Ascending” item from the “Line Operations” submenu of the “Edit” menu. Can this be done? I cannot find any instructions that say how to navigate submenus in contextmenu.xml.
    I was able to successfully add an item in a first level menu (Edit | Character Panel).



  • Through guessing and trial & error I got it to work:

    <Item MenuEntryName="Edit" SubMenuEntryName="Line Operations" MenuItemName="Sort Lines Lexicographically Ascending" />
    


  • And I got this working too…

    <Item FolderName="Sort Lines" MenuEntryName="Edit" SubMenuEntryName="Line Operations" MenuItemName="Sort Lines Lexicographically Ascending" />
    <Item FolderName="Sort Lines" MenuEntryName="Edit" SubMenuEntryName="Line Operations" MenuItemName="Sort Lines Lex. Ascending Ignoring Case" />
    <Item FolderName="Sort Lines" MenuEntryName="Edit" SubMenuEntryName="Line Operations" MenuItemName="Sort Lines Lexicographically Descending" />
    <Item FolderName="Sort Lines" MenuEntryName="Edit" SubMenuEntryName="Line Operations" MenuItemName="Sort Lines Lex. Descending Ignoring Case" />
    


  • @Daniel-Jameson said in Submenu Item on Edit Context Menu:

    I cannot find any instructions that say how to navigate submenus

    The official docs say,

    To add a built-in command, you need to provide the main menu name (as it appears in the main menu bar) as the value of the MenuEntryName attribute and the command’s item name (as it appears in the menu) as the value of the MenuItemName attribute. The MenuEntryName attribute must reference an entry on the main menu bar and must be an ancestor of the MenuItemName attribute, regardless of its depth.

    Thus, MenuEntryName must always be a top-level (“from the main menu”), and MenyItemName is the name of the action any number of levels deep (“regardless of its depth”).under that top-level menu name.

    Further, as will be explained better in the next release of the usermanual, you can also refer to any builtin menu entry through its command ID rather than the menu name



  • @PeterJones said in Submenu Item on Edit Context Menu:

    in the next release

    Which @donho just released a few mintues ago (thanks!). So now my official docs link points to the explanation with more detail.


Log in to reply