Hide Combo Box Menu Item

  • Could we have a feature to hide a menu item (if we don't already). I can currently think of two uses for this:

    • Adjusting one control on a UI changes the displayed options in a menu.
    • All of your menu items are numbers and you want them to correspond to the getValue() number but you don't want to start from 0 or you want to skip values.

    To clarify the second use case a bit more lets say you want a menu that contains CC numbers 1 - 100 but missing out 64, so I'd do something like this:-

    var menuItems = [];
    for (i = 1; i < 100; i++)
    	if (i == 64) continue
    	menuItems[i] = i;
    menuItems = menuItems.join("\n");
    myComboBox.set("items", menuItems);

    The problem is I will end up with a menu items string like this


    I would like to hide the undefined menu items so that the user can't see them but it doesn't affect the order so that when I select option 8 and use getValue() the value will be 8.

  • I can't think of a way to do this without hacking something, but you can use the current text as value:

    var menuItems = [];
    for (i = 1; i < 100; i++) menuItems.insert(-1, i);
    const var ComboBox = Content.addComboBox("ComboBox", 59, 12);
    menuItems = menuItems.join("\n");
    ComboBox.set("items", menuItems);
    function onNoteOn() {}
    function onNoteOff() {}
    function onController() {}
    function onTimer() {}
    function onControl(number, value)

  • Ah that's a good idea!

Log in to reply