ComboBox Sub Categories



  • In my LFO Section, I have the combobox where a user can select the destination. I'm wondering if, instead of having to scroll down one long list showing each Parameter, Can I set it up to where when you click on the combobox, you can hover/click the Module you want to send to, then have that bring out another list to select the exact Parameter? Hope that makes sense.



  • @D-Williams23 You should be able to perform that using 2 comboboxes
    The first populates the second



  • Again: ScriptPanel to the rescue 🙂

    HiseSnippet 953.3ocsVs0aaaCElxwpqVatnEXOsmDxS1XcF1oIcCoXXowIYvXyIF0cA6sBFoisHBEolHURMJBv9Iu+AamitDY64l0ZfI8hN2+H424PMIUG.FiNk4z5sKR.lyW4NcgxFMLhKTrQmvbdh6XtwBo9EpNdQB2XfPliyN+LovoUSV9ye8SGykbU.TqhwtTKBfeUDKr0ZmbzuHjxy3gvaEwK489GMJPqFpk5LDO631mkvCtlOGNmSt0vk47nSCEVc5TK2BFzmi0gKlFouUU3+kBi3JIPBCXSwDUnlMLRHCmTsVMLlSyI0q7cJV4es6XQn3d806.OM2fecDKuG3zXUH0bEHM3iAoyzxPJAeD34rD7ZV.um4NMHUjXqsPX6KcGovCmYbbaeYXU3Kqw2zvcnF8PY6EyuFNKEEtOhNure+m6eP+9ceUaO5UnjBE3OKSEXEZkuVMgq.4.JEoZYm.cbhVgI6492vkYP21densWKzrQKgdIoBksytSAIDXgP+QVH1ezIG5uq+2VF.VHe7os2c4krBayA6vpb2Y2hhta2dFRcdoGxkxqP1Pm0fTExQhiwh0H0uvr+O5+v4NOtBApLi0YF39hTsAzAtACpq2G7ZYiDFxwKokQg9dofISZoTUXNHhqlCgcpVkd208UdKsYdt1BWn5jmOu677W2zrYazV4RUBoazL0Dk9PA1QkEeEjVclU4HxrVk59nOMpaPw95RNpUiTB6EIPobM4dvFH2rxCFhlWhPzUaNIucEImNXXBLGO1s3PhkCdliqyWPyJ9sQmvs7pTfYCqPBjZEzBw4D3FbrSQeSK2S.y0VcRtuk7.rw4+rfumJ1sXsVPenvOtUDZiHgm3vXQfXdT8Ts+bzQH6QeaEGxPSNyw16s9iAUFKQmjkPeQsEn4+vcZ1Uj7fCOjTMvaU48VS9EqIu+ZxGTIu2Z4qTduBDbg5MDvGJEAWSSJtGVuVJliGfNML7afQpIH6FrjL6eOLBGIpCyjb6pyIoKDJMfLvUFHQCcTFgcwxWX7YL7r+FGdtQ90mHbel6DgMHZy3swFvKx19+FukWE018zYyvYn0fso6Y+91duymATdiNyJTyGysoBh+edV7T713..QhB6JLD6uA0CWH2mjoclofJLW3uwmRiCHYmRiCpLxh4Ao52ETz4SW183bMHlT42y2B+gCT1utk2seu9rX7N32EDPaEeGh8MGydaQLuXKhY+sHlC1hXd4VDy2uEw7COXLzu+75LqNtnMAUL4z7wuNNmp3HKKmQx9GfB0W6I
    

    Set these properties of the panel to make it create a nested context menu:

    {
      "popupMenuItems": "SubMenu1::Item1\nSubMenu1::Item2\nSubMenu1::Item3\nSubMenu1::Item4\nSubMenu1::Item5\nSubMenu2::Item1\nSubMenu2::Item2",
      "allowCallbacks": "Context Menu",
      "popupMenuAlign": true,
      "popupOnRightClick": false
    }
    

    As you can see in the popupMenuItems property, using the Menu::Item syntax creates a nested menu. The numbers are consecutively.



  • @ustk Thats what I was thinking also!

    @Christoph-Hart Thanks for that. Thats exactly what I had in mind. I understand this part, now how would I get the selected options name to display inside the panel once selected? For example when using this method to select Instrument Categoeires, then SampleMaps



  • @Christoph-Hart said in ComboBox Sub Categories:

    HiseSnippet 953.3ocsVs0aaaCElxwpqVatnEXOsmDxS1XcF1oIcCoXXowIYvXyIF0cA6sBFoisHBEolHURMJBv9Iu+AamitDY64l0ZfI8hN2+H424PMIUG.FiNk4z5sKR.lyW4NcgxFMLhKTrQmvbdh6XtwBo9EpNdQB2XfPliyN+LovoUSV9ye8SGykbU.TqhwtTKBfeUDKr0ZmbzuHjxy3gvaEwK489GMJPqFpk5LDO631mkvCtlOGNmSt0vk47nSCEVc5TK2BFzmi0gKlFouUU3+kBi3JIPBCXSwDUnlMLRHCmTsVMLlSyI0q7cJV4es6XQn3d806.OM2fecDKuG3zXUH0bEHM3iAoyzxPJAeD34rD7ZV.um4NMHUjXqsPX6KcGovCmYbbaeYXU3Kqw2zvcnF8PY6EyuFNKEEtOhNure+m6eP+9ceUaO5UnjBE3OKSEXEZkuVMgq.4.JEoZYm.cbhVgI6492vkYP21densWKzrQKgdIoBksytSAIDXgP+QVH1ezIG5uq+2VF.VHe7os2c4krBayA6vpb2Y2hhta2dFRcdoGxkxqP1Pm0fTExQhiwh0H0uvr+O5+v4NOtBApLi0YF39hTsAzAtACpq2G7ZYiDFxwKokQg9dofISZoTUXNHhqlCgcpVkd208UdKsYdt1BWn5jmOu677W2zrYazV4RUBoazL0Dk9PA1QkEeEjVclU4HxrVk59nOMpaPw95RNpUiTB6EIPobM4dvFH2rxCFhlWhPzUaNIucEImNXXBLGO1s3PhkCdliqyWPyJ9sQmvs7pTfYCqPBjZEzBw4D3FbrSQeSK2S.y0VcRtuk7.rw4+rfumJ1sXsVPenvOtUDZiHgm3vXQfXdT8Ts+bzQH6QeaEGxPSNyw16s9iAUFKQmjkPeQsEn4+vcZ1Uj7fCOjTMvaU48VS9EqIu+ZxGTIu2Z4qTduBDbg5MDvGJEAWSSJtGVuVJliGfNML7afQpIH6FrjL6eOLBGIpCyjb6pyIoKDJMfLvUFHQCcTFgcwxWX7YL7r+FGdtQ90mHbel6DgMHZy3swFvKx19+FukWE018zYyvYn0fso6Y+91duymATdiNyJTyGysoBh+edV7T713..QhB6JLD6uA0CWH2mjoclofJLW3uwmRiCHYmRiCpLxh4Ao52ETz4SW183bMHlT42y2B+gCT1utk2seu9rX7N32EDPaEeGh8MGydaQLuXKhY+sHlC1hXd4VDy2uEw7COXLzu+75LqNtnMAUL4z7wuNNmp3HKKmQx9GfB0W6I

    wow - much nicer than my version...



  • i need A Little help here, To Show The Selected Item From The menu On A Label:

    I Already Attached A Knob, And It Shows The Value Of The Menu, But Can't SHow The Exact Name Of Selected Menu Item INstead Of Menu Value:

    Here is the Code:

    Content.makeFrontInterface(600, 500);
    
    
    
    const var Label1 = Content.getComponent("Label1");
    const var Knob1 = Content.getComponent("Knob1");
    
    
    const var Panel1 = Content.getComponent("Panel1");
    Content.setPropertiesFromJSON("Panel1", {
        "width": 100,
        "height": 32,
        "popupMenuItems": "SubMenu1::Item1\nSubMenu1::Item2\nSubMenu1::Item3\nSubMenu1::Item4\nSubMenu1::Item5\nSubMenu2::Item1\nSubMenu2::Item2",
        "allowCallbacks": "Context Menu",
        "popupMenuAlign": true,
        "popupOnRightClick": false
        
    });
    
    
    inline function onPanel1Control(component, value)
    {
    	Console.print("Selected Item ID: " + value);
        Label1.set("text",value);
    };
    
    Content.getComponent("Panel1").setControlCallback(onPanel1Control);
    
    
    
    Panel1.setMouseCallback(function(event)
    {
    	this.setValue(event.result);
    	this.changed();
        Knob1.setValue(event.result);
        Knob1.changed();
        
    
        Label1.changed();
    });
    
    HiseSnippet 1144.3ocsVslaaaDDdosnSDaUPBPO.D5WxntFRx1oENnnNV1NUIw1BgoF8GEHXE4JoEhbWVxk1QHv.8bzSSOR8FzNCWRwGV1MQ.kFvPyy8adryNihjtr3XYDwn46WDxHFesoyBgZ1fYTtfL7DhwSLOmFqXQ1ZVGuHjFGy7HFFa9JjgQyFjzu+9mNl5SEtrBVDxURtK6s7.tpf6nidC22+LpG687fRZu+QCckhAReYBfmMM6RBotyoSYWPQ01vjXr0odbkLxQQUrXPmikdKblIuQn0+JdLerOCI5Qb.GoYSFLi66MJOViIDiFiJh7M0Q92XdN2iujeQF3ooBrKrnbNvXipPpQEH069fzYReOzA2C7LJAuFZ38LSG2HdnpPBhsuxbn.JNSnPZuLrz5R13UMLGHAMDpcCnyYmEADKsnyy61cG6C51c6WzxR+GT.hU1WSireKcLyum8OZma+TlZfLHTJ.hNs0haiVVXyaDxw2uIoRameVEVMhJdnSRKN0tbEhYXZHjEo3rXHlBdsykWrTycr+TKKa3q8MbO0r1GZ2ChyLVyX7oyT.u85myJTFlDdNSjLTwBhAQscRFiz8N7PjUueSTkQ+5L1qNi8qy3fkL5W2oYL52NGOTee4MCf+OFZ+SwSZb+QkMpd66.6W5ymJ.0TQIrJBuT7NLXG3ycmCxmP8iYZ4srtMuNvE9bAydRhvUwkBaoPmFwyLR52wMuRrCTr7SXa2xBRuMAwwRe1tgQbrH4v7YtJlmMFJ1COA.s82lYvKzmotiAqccZiQS6cVJ91Tr7vkezvLLkma5TCqEswZ1nImKShYKMHOJ6vtFbdVnnlwiQUuBgiVxtQr3DeE5PsX2YTwTlWm7fIsW99MpPk5FhnqT1nrXnjTpJbgTwtTzYaqOY0z5VK65hlLYkxxRE9rnUJFm3F8PF1QjDLlEkWryUDFCUcN2Vedy4b00zRJJECEb0kgrL5hIg8VwjPRVSANSLCgfppzIhOIahniO2iEQ3fSdjYZVmjBdhgowivGV9kgmPUzbW.dqX3Av6D10vaT5grMMOgEOWICgCYYOHD6+mG3GKdF60GsXIwnviHk7ik1OsxGkicoot4wl5NVzOlFGBVt.+weB+HcFF3vs7xdRUOAC4Xmwo5.CDmkGXPpNeiX76l0luYUa7VM58pQueM5CrpMZqFcexclFgAGh7pyvPtorKkxLqlxRu1jkxzWgJk5+ietTp+uleDlBV1Db2WTg20kdI9TU0G6wsZxD.2Lp7pJ9xoHlqVTdqmufM.5txM.VYe+mIbel4Htxc1pw6Fq.uvsf+uwa19TsLOcxD3QgBv1v7reccWd5K.JuSln3homSUQb79zEIANvJktL.IB3VVL1SrA1loo6l2M5vDdoD+C7kIrWdSIJrWtPR.0MR9AW8DIbisGmxAvjHcY0lvVy.scwnHyt61kD.KR9AWWLU7c.1WsM8WCa1aMrY+0vlCVCad9ZXy2uF17COnM3N7uLQICzWS.FiNM8YACiSETnKKsij7u.RBUmSC
    


  • I'm going to bed, but this should get you started

    inline function onPanel1Control(component, value)
    {
        local t = component.get("popupMenuItems").split("\n");
        Console.print(trace(t));
        Label1.set("text",value);
    };
    


  • @d-healey said in ComboBox Sub Categories:

    inline function onPanel1Control(component, value)
    {
    local t = component.get("popupMenuItems").split("\n");
    Console.print(trace(t));
    Label1.set("text",value);
    };

    Thank You Sir 🙂 Sleep Tight ❤



  • No Luck 😕

    @d-healey said in ComboBox Sub Categories:

    I'm going to bed, but this should get you started

    inline function onPanel1Control(component, value)
    {
        local t = component.get("popupMenuItems").split("\n");
        Console.print(trace(t));
        Label1.set("text",value);
    };
    


  • @Natan

    inline function onPanel1Control(component, value)
    {
        local t = component.get("popupMenuItems").split("\n");
        Console.print(trace(t));
        Label1.set("text", t[value - 1]);
    };
    


  • @ulrik said in ComboBox Sub Categories:

    inline function onPanel1Control(component, value)
    {
    local t = component.get("popupMenuItems").split("\n");
    Console.print(trace(t));
    Label1.set("text", t[value - 1]);
    };

    Thank you Ulrick 🙂
    So What is The Trick To Not Including The Sub Menu's Name, Just The Item1/Item2/Item3...?

    Thank You Works Like A Charm, And Thanks To @d-healey I Didnt Figure It Out Until Ulrick Sent The Code Again 🙂



  • @Natan If you don't want to include the submenu name

    inline function onPanel1Control(component, value)
    {
        local array = component.get("popupMenuItems").split("\n");
        local t = array[value - 1];
        //  Without submenu name
        local t2 = t.substring(t.indexOf(":") + 2, 20);
        
        Label1.set("text", t2);
    };
    


  • @ulrik said in ComboBox Sub Categories:

    local array = component.get("popupMenuItems").split("\n");
    local t = array[value - 1];
    //  Without submenu name
    local t2 = t.substring(t.indexOf(":") + 2, 20);
    
    Label1.set("text", t2);
    

    YOU ROCK 🙂 👍 👏 😛



  • @Natan actually this is better, it will follow the length of your "item names"

    local array = component.get("popupMenuItems").split("\n");
    local t = array[value - 1];
    //  Without submenu name
    local t2 = t.substring(t.indexOf(":") + 2, t.length);
    
    Label1.set("text", t2);
    


  • @ulrik Have You Noticed, If You Dont Click On The Menu When Its Open, It Will Show Some Errors?

    Interface:! Line 2705, column 27: Unknown function 'substring'
    

    Just Click On Panel, Once The Drop Down Shows Up, Click On Outside of The Panel



  • This post is deleted!


  • @ulrik
    And Here you Can Clearly See That It Goes To Zero, If You Select Nothing:
    It Goes To Zero, And Shows The Error:

    HiseSnippet 1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mr6s2St7SFd1bZIEkhgBl5zHp315TixJDz8ryXEnpxzw9QYcrGyY9zXDCZL+YtlHMxP3hWA+59neY3ADEI2MfGKZvAXGPOGdS09PPM2CnImojQvFsn1CNj+ua5kEa3K5OewhQQ8CIWV9IYTI2V251F4u9nKVMd8gt1B2xt83RtsuWeS6W.3A9YSFXa9pQvYHK2qSS+x85PK2T.47GtUZMWuRm4Jq2tx5cprd25U5JWYcOz0ZjBQZGMyWt8qF0.e8LRdnybKJKzYuQUJz8m+boP2ecVecHPm4rj.c8wAfgRj9obhZ4IUzimkI.tprzHA5m8EIL07xiucuL9xmJcer6HlxK3l46Z2.egqG227MaXvFtGNcJ7hVAY2v8ne89exOzqg2vfWnNl.OTAkGtmjFNFlM1iBLQ.22zsybVSWnYW2IudbLU3aV7uvmLgcyKK0B6lKDER7hkevy1tROt4CMH.mDlotqAi+CqwK5S451ocGTHLE7G77zghm.b+lso2JXy1qfM6rB1r6JXyyVAa91Uvlu6NsQ+Of77TkLzdMA.Fcn48BGmCEDnJyTQh9O.MJF1IA
    


  • @Natan it's because if the value = 0, then value - 1 will be -1 and you can't take the "substring"

    Try this:

    inline function onPanel1Control(component, value)
    {
        if (value)
        {
            local array = component.get("popupMenuItems").split("\n");
            local t = array[value - 1];
            //  Without submenu name
            local t2 = t.substring(t.indexOf(":") + 2, t.length);
            Label1.set("text", t2);
            Console.print("Selected Item ID: " + value);
        }
    };
    
    Content.getComponent("Panel1").setControlCallback(onPanel1Control);
    


  • @ulrik said in ComboBox Sub Categories:

    @Natan it's because if the value = 0, then value - 1 will be -1 and you can't take the "substring"

    Try this:

    inline function onPanel1Control(component, value)
    {
        if (value)
        {
            local array = component.get("popupMenuItems").split("\n");
            local t = array[value - 1];
            //  Without submenu name
            local t2 = t.substring(t.indexOf(":") + 2, t.length);
            Label1.set("text", t2);
            Console.print("Selected Item ID: " + value);
        }
    };
    
    Content.getComponent("Panel1").setControlCallback(onPanel1Control);
    

    EXCELLENT 👏 👏 👏



  • @ulrik Ulrik
    Trying To Add A Pre Next Button To The Sub Menu, But It Doesn't Work And It Loop Throw The Menu.
    Do You Have Any Ideas?

    HiseSnippet 1430.3ocuX0saaaCElJMJq1aYnEXWtKH7UNnIo1NIcCYXXtwIYys0IF0coCXcnfVh1lHxjdRTownH.6QaOR6MX6bHkrjUhcCxPpDPP34O9wy2gTG5tgJOdTjJj3T5MSmvINekauoR8nViXBIo8gDmu1sCKRyCoVQGLcBKJh6SbbdvOiBbJsJw77O+zAr.lzimIhPNSI73uRLVnyj1s4KEAAGy74uQLNm061rsmR1REnhA77.2ZjILuyYC4mvPyVwk3r1Q9BsJrmlo4QDmUOP4Os2H0GjV6OSDI5GvwA0I8f.YEerJvGQLJkzZjHvua55Nh.QoaVV3A1rv231Q3KlIOKa7HiBZlG4yGNqrL3UOO7pc6gmSN3spEdO1smWnXhNSChsuzssDHpALfBxCKqsjUZUxskBrPp2dL6b9wgvfYdT8Y0psIcuZ013GVur8EHiHM8BVH8Ur97f5zejl5+PttkZ7DkDFTshUcEzyLedoT0ewtXzVIctx7pKStrYxp13WpAQbLMLgGpE7HXMM9E8N8jYVtI8iqWlBOU9fvWOpx9z5v5LQzHtX3HMHamFohlnlDOoCWF2VyGGAppzKtONt996ihp+N47BZTTvNEEraQA6MSPihAMQPiJo3gEDn9PK3u8gsBF7XV2Wpon4UtFredfXnDLSGFymS4oxWiK1VABuyA8CXAQbq90KeUJOHjABImNHV5oEJIUIsoQbNCUAU8RYhMAxJHluw5kSRuhAzpohvwIhwm.kGKfxBCYSAdcVHPlsZw78FaGMIP.xemzPxyGCM3uIN+tYpnaQq+G4L5oOkReqPOREqoQw8GCQkJgiNtVXZ.wAJbh6GoCExgU0aKj97KOcP0J6WYC5SnM1DzGvkC0ixiBacNVwUsBxAP0ktQdCf7TjJfu8DHrfM83AbOM2mhKNZ6CA1CBtMMk30UP12j7Wd8NNmIjPZwP0BjS19VqXzkNp3H9LGRo0p7Kffa4tR5QhHzzyPTY0rcHOJNPiAzp1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