ComboBox Sub Categories
-
@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.kGKfxBCYSAdcVHP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yt2Ae16N3yytC97c2Ae99k5C9iy77XsZrcaBHn6Qlu843bjjAUYlJRx+gf0V3I
-
@Natan what have you tried so far?
-
@ulrik Check Snippet Above,
I Did This:/// Next Prev const var Next = Content.getComponent("Next"); const var Prev = Content.getComponent("Prev"); // Prev-Button---------------------------------------------------------------------------------------------- inline function onPrevControl(component, value) { if (value) { Panel1.setValue(Panel1.getValue() - 1); Panel1.changed(); } }; Content.getComponent("Prev").setControlCallback(onPrevControl); //-------------------------------------------------------------------------------------------------------- // Next-Button ---------------------------------------------------------------------------------------------- inline function onNextControl(component, value) { if (value) { Panel1.setValue(Panel1.getValue() + 1); Panel1.changed(); } }; Content.getComponent("Next").setControlCallback(onNextControl); //--------------------------------------------------------------------------------------------------------
But It's not Stable
-
@Natan I thought you said you want to get previous and next "submenu" ?
-
@Natan said in ComboBox Sub Categories:
Trying To Add A Pre Next Button To The Sub Menu
Do you mean you want to get to next/prev submenu?
In that case you have to know at which indexes they are located, like in your snippet you have the first appearance of SubMenu1 at index 0 and SubMenu2 at index 5, so you have to work with those indexes to jump between SubMenusSomething like this maybe
// sub menues local subName; local subIdxs = []; local items = Panel1.get("popupMenuItems").split("\n"); // get indexes of first apperance of submenu for (i = 0; i < items.length; i++) { // get sub menu name local sub = items[i].substring(0, items[i].indexOf(":")); // check if sub name is different than the stored one if (sub != subName) { // store indexes of every "new" subMenu subIdxs.push(i); // store current sub name, to be able to compare with the next subName = sub; } }
With this you'll get the first index of all submenus, dynamically
-
@ulrik Thank you Ulrik :folded_hands_medium-light_skin_tone: Will Give it A Go
-
@ulrik Where Should I Place The Code?
It Shows Some Errors Again :/ -
HiseSnippet 2061.3ocyYrsaiabkzq4lH051jh12mpmjfur5xtIE1q2pX6cKbS7kFktI.aL1PQNRZfolQfbnu.CCjOk1+f9IzOo9GzdNC4vahT1V651RCXn4baNy41LyYN0W3PCBD9Fl09tqmQML+kVCtlKmr+DaF23vCLL+0VGaKs4CBGdDkGFXr20yrCBntFllO4OgDYVaUC02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WR5d29vhUNi8LuS6ghB12ryY5JnUHfxN8p9anO097EZxyOhlbaiEn3EyMyqvEyNWffxYx1UKGHqSshKm9ap9VvUYPYpKfTkU7AXMWfUsBqa4V4ps1e.qx7dgkaIW9Rp9hgb6cm0luQHku7qHU5UowEkmX7fyy9+ybo4ceXx0qhRx1byGdB0qxlOs4G27o0+uW9zCM3K490JK6PX+wxNTU5AyFV80LJ+PdPVxsYO6uPROg2rU8apWqNnMEQMZTo3hElG0uTzXij8WDiM4gSGR80myTSng4p4aYqU0srMaGkchN2cFBE7C4L4Iyn7pZjqQ7g0wV5FqU.oRUCc+UwMzcfGyk5avbML+DKUyVLTJrgYsmZp6o9e8vCrk1Zw.RLs+h.rCnWvbnQ8Itl0AzfykhYf3Rte.rHuyI8pjtx2m2+5jAmNq+T6qx1wdiLhsdjXWS2bZLfVI0O0JJ3NiXIyxH19N8Uc+DWktwKxndehPHwPx2xPT8y1xPi7mz1v7uaUnon0KzSzBi6UX7yKL9E0KzOzBiSjWuB36UN9dFy0+Rvynbx465IBUAddOn1TqZ9VroNpQbYM0hLl5+448QSF5oUJYNo9I4iKh5OfRrO0BSvyHzeZbFg9SN8CrufdHVE.pNfu4.K3HAr6kz1GHybEs6MNt4uz+9NsXMkLS6+3hLS6O+XMs0rheDgLy7eyIa.66eXy7O+C26YNtHZkq4kXlm+8i9LqiDtgd1x7OsE9ddwHfhm4dCI7ch3AL40YeuuGk2659ptet0oLoyjx02UJQegBlO15a7qGtl0qgay5HSU1UsdyO73+TgFeqHTBWH+Ha3d4P.j0wgSGHB8cnflvgJv3FblqfkRhF2VWwY.k6pF7uguXjczEdPjczHMlZ63KduSzFX36S9oJHfNwUOSaMqivwjjctrrZuUaioLW16cbPSwlftWNOcWBd5sD777kfmWrD77EKAOe4RvyeXg7fuX8WEJESiRS..m9Z0IHLMeMG6MgJhz3+.kK0y0
Excellent Job @ulrik
So It's Not Possible To Go Throw All Menu items!? Right? -
@Natan This goes through all items
-
@ulrik My Bad
Absolute Genius :) Thanks Man -
@Natan Thanks, this works perfectly. But how do we load the sample maps in the sampler? I understand that we should add a line similar to "YourSampler.asSampler().loadSampleMap()" inside the panel function but I don't know how to do it. Anyone?
-
Oh, after hours of trying I realized it was pretty simple. Just had to add this line inside the "if" of the panel script.
MySampler.loadSampleMap(t2);
I'm not sure why but it works; I think t2 in this context is the name of the sample map (I'm new with Hise)