Submenus in Tracklist Menu Items

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

DaledeSilva
Posts: 906
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Submenus in Tracklist Menu Items

Post by DaledeSilva »

I've been trying to create a submenu in the tracklist menu, however, I can't figure out how to make it work.
I can make single items work that aren't in a submenu, but if I give it the property of submenu with an array (like specified in these docs), it's stays as a single item with no menu of children that fold out.

ie. in the code below, all I get is a single item named "Auto crossfade settings".
Please note that I've tried adding in order and grouporder values, and removing the 3rd level of submenu, but haven't seen any difference.

I'm adding this code in trackListView_add.js

Code: Select all

window.menus.tracklistMenuItems.push({
    action: {
        title: 'Auto crossfade settings',
        // icon: String,
        visible: () => uitools.getCanEdit(),
    },
    // order: Number,          // Required
    // grouporder: Number,     // Required
    submenu: [
        {
            action: {title: 'Selected tracks'},
            submenu: [
                {action: actions.autoCrossfadeTrack},
                {action: actions.alwaysCrossfadeTrack},
                {action: actions.neverCrossfadeTrack}
            ]
        },
        {
            action: {title: 'Entire <insert name> genre'},
            submenu: [
                {action: actions.autoCrossfadeTrack},
                {action: actions.alwaysCrossfadeTrack},
                {action: actions.neverCrossfadeTrack}
            ]
        },
        {
            action: {title: 'Entire <insert name> mood'},
            submenu: [
                {action: actions.autoCrossfadeTrack},
                {action: actions.alwaysCrossfadeTrack},
                {action: actions.neverCrossfadeTrack}
            ]
        },
        {
            action: {title: 'Entire <insert name> collection'},
            submenu: [
                {action: actions.autoCrossfadeTrack},
                {action: actions.alwaysCrossfadeTrack},
                {action: actions.neverCrossfadeTrack}
            ]
        },
    ]
})
Product Designer & Indie Developer.
Building at the intersection of motion, art, and code.
Find me on twitter and all the other ones here.
DaledeSilva
Posts: 906
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Re: Submenus in Tracklist Menu Items

Post by DaledeSilva »

Oh dear.
I just figured it out by stumbling upon this other forum question and seeing the code there.

The documentation page here says that submenu should be defined here in the hierarchy:

Code: Select all

{
   action: {},
   order,
   grouporder,
   submenu,
}
But those docs are incorrect, it should be:
The documentation page here says that submenu should be defined here in the hierarchy:

Code: Select all

{
   action: {
   	   submenu
   },
   order,
   grouporder,
}
Product Designer & Indie Developer.
Building at the intersection of motion, art, and code.
Find me on twitter and all the other ones here.
Ludek
Posts: 4964
Joined: Fri Mar 09, 2007 9:00 am

Re: Submenus in Tracklist Menu Items

Post by Ludek »

Thanks!

I've just corrected the documentation
Post Reply