how can i use a Combobox to Switch panels



  • Finally i am not going to use buttons i would like to have only Comboboxes!



  • @LinuxVst said in how can i use a Combobox to Switch panels:

    the Combobox values are not Numbers the are the actual samplemap name
    let's say Drums, Guitars, Pianos

    yes the displayed values are these text items, but the returned value in the combobox callback is a number - the position the end user selected (starting at 1 not zero)

    inline function oncmbPanelControl(component, value)
    {
    // this is where i'm Stuck i do not know what to enter Here!
    // start by putting this:
        Console.print(value);
    //.... and it should give you a clue...
    };
    
    Content.getComponent("cmbPanel").setControlCallback(oncmbPanelControl);
    


  • i Do not Get it yet!
    i am able to get the values of the Combo box

    with Console.print(value); it gives me 1-2-3-4

    but i do not know the inline function to get it to switch the panels
    i tried with Panels.showControl(true) but it did not work it displays Unknown Function?

    Content.makeFrontInterface(600, 500);
    
    const var Panel1 = Content.getComponent("Panel1");
    const var Panel2 = Content.getComponent("Panel2");
    const var Panel3 = Content.getComponent("Panel3");
    const var Panel4 = Content.getComponent("Panel4");
    
    // Panels Array //
    const var Panels = ["Panel1", "Panel2", "Panel3", "Panel4"];
    
    // Combo Box //
    const var cmbPanel= Content.getComponent("cmbPanel");
    cmbPanel.set("items", Panels.join("\n"));
    
    inline function oncmbPanelControl(component, value)
    {
    Panels.showControl(true);
    };
    
    Content.getComponent("cmbPanel").setControlCallback(oncmbPanelControl);
    
    };
    
    
    HiseSnippet 1040.3ocsVE0ahaDDdMItJ3qHkSppuUIKdhHkRVrMDPsU0GPREpM4PkznJ0VccwdIrM16hrWxEzo6+78OncWu1XSfPthRfGfYm4a1uc1YlcFFw7vwwrHfV4qVLCCz9R8QKn7o8lhHTvf9.suVuGKbLyrK6dygHJNv7JbLGzcwLTbL1Gnos2OIsUq79fjOe5G6hBPTOb9R.v0LhG9WHgDd9pCc+YRPv4He7UjvBV63NviQ6wBXyE7ZOcHXFx6VzM3KQRyJoCz9hy7IbVzHNhiiAZ62k4uXzT16oJ6ulDSFGfkBM.iDNRs74r.eIikqB5MkD3OL67GCDdYXdzXOUz3qzuf3SVtddT4vDEl4HJFOzJsM50nH8fe9zSq.81WQuWqOxKhLimqQxsWoOfxwQSPhqfhzRYKnjwdhqTgETd8Pzs3yiDBKQTqEDdrYSH7nuqhQECwEQL27NTj5tug4OXlg8FLWjYLiQEB0ppTWUh5AXr1NFqMgwd6Xr2DFmsiwop5DcxIJyiMeSTDZg4ImrlmhEd5OxNQGalwyr+Yu7eNU+qLelWjrpC8BGmX5iwsL8pSTpP8XrPEgiCiE6khS0+GFgVq5eRqdj5fPnADJ1bxbpGmvnlLZFb4NEwBp4ksMGKnRvb7QUL9PECIQhYA35yhHBFnzH73GS75SwRI0R8eOTPvXQkYs01YEAUNT9s.GujwwukV6HiOXT13iFlOT0jIaTWpiCvQaTsrARz1.ViNObLNJKPjYnnRZ0RU8GuTsXmDOUTpfgL5.Jg+1YX5iU.CRCsxR4TVILkmTHeXZgbRVjHIBPDUrF5YgUPBqy6PdnK32FzGwQY9R3VwVMCGwIxSgVe7ch9splDk06iiukylINcKuRAZGn14JYsPR1G41dftJyGbe9FRbWjKz288De9zkK7oX2oXxMSKzZO1Ul7l0B+U5ssrfMZCcZCxW2ZUEfBbq7SvMqmUtA6X2pS6lMWiav1M5.sfmBtqXC6+OD094knm1pUSGX6MPTqlMsrs1ch577daC6.sa0Ft9scCmN1MgNOIQepBhBrsaA15d8CXK3uWiseuaHR.WWSJyw2ySFoHoYKP6aRS9MT4YperMRiQf0eBVLH.yed.hu5zAxQhRUH5CsxyvxmZowD9hhiL8hLxvmKces9PB2a5l4aoMvWQamWZ9lN.VE8ylLA6wyI695m+6u7SaA9U1bNgdyEHdDQlsb47vQhzXOrfIT46wxLnRxt5JYnTVFYFgo9IB+q3SpxFRYsTkMxTBBQdQr24odKPNh2AIqH3DMYR2x5WHkMaj0+WWGVGBBESd9NOOYn3aEbeyXr1AL16.Fmc.Syc.Sqc.yo6.l1aEibn+2LmyBUkIhEFdVx6vZZmQQhrrjLRv+UNxGRJ```


  • Panels is an array. You need to provide an index to access the items in the array. For example Panels[0].showControl()

    You can use the value you get from the combo box as the array index. Remember the combo box starts from 1 and the array starts from 0 so you will need to subtract 1 from the combo box value.



  • Hi David
    thank You for The Help!
    i do not Get it yet i am Really a Newbie!
    Still Getting Unknown Function showControl
    how do i create an index for the array?

    Content.makeFrontInterface(600, 500);
    
    const var Panel1 = Content.getComponent("Panel1");
    const var Panel2 = Content.getComponent("Panel2");
    const var Panel3 = Content.getComponent("Panel3");
    const var Panel4 = Content.getComponent("Panel4");
    
    // Panels Array //
    const var Panels = ["Panel1", "Panel2", "Panel3", "Panel4"];
    
    // Combo Box //
    const var cmbPanel= Content.getComponent("cmbPanel");
    cmbPanel.set("items", Panels.join("\n"));
    
    inline function oncmbPanelControl(component, value)
    {
     Panels[0].showControl(true);
    };
    
    Content.getComponent("cmbPanel").setControlCallback(oncmbPanelControl);
    
    };
    


  • I didn't notice before but your Panels array only contains strings it doesn't contain references to the panels. Strings don't have a showControl method.

    I think you'll find the arrays section of this video helpful:



  • Thank You David but i already Looked at this Video
    i even tried Changing strings to numbers 1-2-3-4
    i have No Problems Getting the Values with Console.print(value)
    i still get an error with showControl method
    is it possible to Change Panels with a combobox?

    HiseSnippet 1036.3ocsV01aZbDDdOauUlKEoDop94S7IPhh26EvfRqJAvtB0ZGTw0pRoVoK2sX1561Ec2hiQQ4+b9Gzt68hui.FmhrgOMu7L6yM6LyNiB4tjnHdHPqzEKmS.ZeKb7RlXV+YXJCLb.P66g84AS3F832YLByH9FWPhDfdKmiihHd.Ms8+EkuZkN.D+6y+bOrOl4RxUA.WxotjeiFPE4ZG08Wo99mh8HWPCJ3sS2gtbVetOegjW6CQf4X2avWSNGqbaOHP6aNwiJ3giEXAIBncPOt2xwy3efk3+kzH5DehRvDLVFnD0mx88TLVoEzeF02aT12eDPFkQ4Yi8SxFeG7LpG8d84YkWFavHGQw7g1daidlEoG5qmdZEn2AIz6Uvwtgz4hbKJt8B3PlfDNEKuBJRqDeA6UZe4UpzClnQ.9FxogRg6QTsEBU2nIBU60k0KqKuHhDF2hCMvF+jw6Lu50E0EWOXJMjEuqIBY0xbNSJTsRh4J0VGi01wXsIL1aGi8lv3rcLNUR9JO5nD2iLdSXHdowQGsVjhh+7qaXU2vttgyUY3xaNVEjavjXbOz4mYOg0oBMhHRSTAIHpR8zysw+vorpU9KVkZIjkx7oLhwzELWAkyL3rL3pSJj6W0M6XpKoh+BRsx5errdZ7dG5pFQxZwLmEgRGjA9SwA+wHqhgoH6i88mHaLqtFAR3YR.U+KP0y4BxaYUqo+Q8R5eR23KMMc5FskFXeR3FMqleDtMfUYKBlPByxGYNJajVsSE9vcpEGj3ljkJ3HmMjQEucNg8P8ufzTqpSNkURWEw8wuLsONtXRVKAnxFVcXVZEDy5hSXA+wvAXANKVxvJOp4jPAU8UnMfbqbbaxLhRvAjnaD74xut6uRAZGlbxkylfDeNpi8PXRaK3t7Cj1cYtvftef5IlcuhOG0cFgd8rBS1i5ppgylf+BXaKKjYajSaPtdqUM.JvsROB2rdR4FpicqNsa1bMtgZa1AYgNFbaw40+eHp8SKQOtUqlNn1afnVMaZYas6D04o81F0AY2pMZ8aaSmN1MQNOJQerFhBrsWA118xufsf+dM19icCvR3PMkrfbmHdih3YtplEScKcacG41Iq8Zq7Met2BerX0EATa+jZPNyYkWbUupxhnhkE6ceV1N3qktuBNhJbmsY9t2F3qbDyyMeS20pL7joSIthbxd.7z+74ewJvuyWHnrqOCKBopJiyWDLVVx5RjLgodxTUsrmZBdhLRIqxLiILuXg+U9K0noRVK0nYlQP.1Mj+d2j49ps4NLVijSr3kZKAOSIaXlMqGBQMPf.4Rlu20UkJ9AI22LFqc.i8NfwYGvzbGvzZGvb7Nfo8Vwn1u+MKD7fj1DohQmD+lql1ILrrJKthD7eIoCf2.```could you try it to see what is Wrong


  • You need to put the references to the panels into the array. At the moment you are just putting the names of the panels in the array.

    So instead of this

    const var Panel1 = Content.getComponent("Panel1");
    const var Panel2 = Content.getComponent("Panel2");
    const var Panel3 = Content.getComponent("Panel3");
    const var Panel4 = Content.getComponent("Panel4");
    

    You need this

    const var Panels = [];
    Panels[0] = Content.getComponent("Panel1");
    Panels[1] = Content.getComponent("Panel2");
    etc.
    


  • hi David i Tried and i Can't Get it to Work

    Please Check my Snippet

    HiseSnippet 1088.3ocsWs0aaaCElxIbnVcFqEXXOK3mb.xhojuDGzMLmqCFaIwXNKX.cEczxzwrQhTPhtMFE4m49ez+AaGpKVJwNWpQhySmq766vyg5j9gRWVTjLDYT9rYALjw2hGLSnlr+DJWf5c.x3Gv6K8GJs1SdkUepf4YcFKRg1aV.MJhMBYXr1up80n75n3ee4W1i5QEtrbUHz4RtK6249bUt19c+Mtm2QzQry39E7tY2dtRw9RO4T.WqgIn.p6kzKXmP0tUBiL9lCGwUxvAJphEgLVeO4nYClH+jHw+y4Q7gdLsfMZ.jnD0GI8FoQrVKZ+IbuQ8y3eDBxR+7pwZIUiuGeLeDet97pxqhMXkGQw5gQo6Cd1EgG4wCOiBva8D38Z7.2PdfJ2hFauD2SnXgiovUPQXk3Kpz+VBtRAODps7oWxNJDDlGQs1DxlVsHjMdSEyj+pWO4hOxZ2vP5Lq50qXBWPQJqORCyL8yVu8cwQjH+Vx6.UYGyELEzDEHEfPspwdXWci2j4q8C3qSUMXRc14AbtQgD23A7sY0LVBbLuM+lDz0eXry2UlxrGmq50yD2JhAF4JleT0MSqRa8AIWTq5eKptQxAyEdbAyZ7TgqhKEVRQV35yJT5UyM6f1D.i2T1FUL+bESq4U4shf9pLmUgfCPhuNN4ODb0HLMx8oddCggrZK.fDbd87lgBP8Dohcpn1Fle1rr40lV21z3wK0VZh8XgK0r9sfv6KvZho9CYgY0iLGgghaN0gu6othOJ3lTkJ3nTzSvUmFvD20rHJszpmJSQE3pJdl7UoyjwsSP2DhCCel3rxJJF04O18ptn+r2ATEMKWPZgiJfEp3ZVXb.6ivSmIy6kwGvhtTIC.1M+JExdxIWI60f3yQeru.mLqgtJ+.4cmkKbP2OwGolLWwWh5NgwuXRgWoi5p6gydM9k3NNND6Njl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SPW+KhcdVYJydZt3BOtfgGLR3p3RAVJxbPGdnzqpaVruAxu2H1ZUr9REKL7MPFhqxALS1FywuKs1ttGSboZHn50udsDG0eobje95QPqUVxiyH9sXa7N6f4ZHcaLrlG1WORaHNG6S87t.l3pNAzSX3s20YTfjmHUr2Kptl0WrJacqE9aMMXvTsklXOV3TMqeXH7gBrpXj+ErvrJYlivDx8GAMm8HXwWHbSpREbTJ5H3p2GvDyZvDkVZ0inonBbUEOf9xzAz3dKn0BwgIQKyrxJJF04u7sRaze24.phlkKHsvQEvBUbMKLNfcM7NZxveYyCXQWojA.6t6JEl9SN4JYOMDeN5icEyjAOzM4GHu83bgCZ+Yde0v6T70n1CY7KGV3I6n1bEyO6o4WX1xwgX2hTuEJWuy8MDHCFEbLSLpC3QTAX.cYPaaZuFX3mL20yCmq35rqHikPeG7y4Ikejsp0bqVMZLA+Hsr2h3P1bB9UNEFVKJAslCAq8zRvMa1rQcRqoPPmFMbp4LKBVa9D764Zq9SaaIYKRslsHS1VZWeqZMH0mEqpuvWakebS7EX4dEXY6y9FVh9zDr7cs8oP3lFZYE6FU7tP7D7+qoiUVoceo2Qo0Vzj6N.avH6Oxipt+ZM5c4RM.Ozdu8Gz6HHh3pwE206YYWmGKbekYWtxc3zwaoofW3c0ma7lt4XEyCGLf4pxA6xlG8OO+qIh9K4HEWb4wTUHW2sbxH+dP6uKCPhPuwftCpj9msRjIZYckoGSzOV3+fuTi1ZYiTi1YFQ9T2P4GcS9wN8toqDqAvjHdE8xlGqkw1Y+.moIYcBxGVY9itt5RwaArO8XbVfXps.wTeAhowBDSyEHlMWfXZ8fwn+uU1cjR5mLl.J5dX7hFFFGJnPWVbGI5+ADeA.+C
    


  • Thank You So Much David i will learn from this Snippet

    Mike


Log in to reply
 

10
Online

1.2k
Users

3.9k
Topics

34.5k
Posts