Sample maps PopUp menu
-
I am trying to load samplemaps with Popup Menu items. Combobox is working but Popup menu not loading sample Maps. Here is the Code, Snippets and Project. Please correct me.
Content.makeFrontInterface(400, 100); const var Sampler1 = Synth.getSampler("Sampler1"); const var sampleMaps = Sampler.getSampleMapList(); const var ComboBox1 = Content.getComponent("ComboBox1"); ComboBox1.set("items",sampleMaps.join("\n")); inline function onComboBox1Control(component, value) { Sampler1.loadSampleMap(sampleMaps[value-1]); }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control); //popup const var Shape = Content.getComponent("Shape"); const var ShapeLabel = Content.getComponent("ShapeLabel"); inline function onShapeControl(component, value) { shapeLabel.set("text", Shape.get("popupMenuItems"),split("\n")[value-1].substring(7, 15)); Sampler1.loadSampleMap(sampleMaps[value-1]); } Content.getComponent("Shape").setControlCallback(onShapeControl); Shape.setMouseCallback(function(event) { this.setValue(event.result); this.changed(); });
HiseSnippet 1533.3oc4X0saSbDEd13r.1MoBPbQunUcqUuvQJXrg.TApBm3jfhZBwJa.pTaEZxtismlcmYYmYyOEgT6aReD5iPej3Mn8Ly92XGGiIpPQs4Je9aNeyYNy4a1zKl6QDBdLxp59mFQPVKX6dJSNr6PLkg1ZfiryBFJVBJmHsusoztAiTZXXxMH3DexIRIfV6zHrPP7QVVUdrJHqpyiz+8lGsFN.y7HkpPnmwodjsogTYo1dc9NZPvlXex9zPCuWoyVdbVWd.OA.XE6VnHr2g3AjmfUtMmMx5Ra3Sk7XWIVRDHq4Wi6ep6P9wrT+eFUPOHfnDZibgEJU8l7.eEhUZQcGRC76kWHDHjkcuxxRkzxxMr2g5SKzWVdtp1fSYDl0Cq4lF7ZaBuVyN7rLf27ov6Z1tdwzHYoEE19D6sXRRbeLbDXBqTeQys471c4fGLYyP7gjMiAghHZrRqVK6ztUqkd3h0fiAgz4HbrSZyPbamu0Q2nzb.QloqQ8bi0UwXFkPa.5fDp3R8pLRP+1Tgrw3Q0kGd.eM9IpjkCTHHPcDmABMpW3gNiERMEDvHUR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ZL9DlI7A.W5i5uO4C2T1JyFbeKeBU0bL5RUmNavNBtYBZTX75.qeeL75rbsiNkXGNiGMjyndidO.5qGLfDah8ItgVUJgqgkZtQm8HADrv3h7W2YafLEGO5062oZQ6YuVLsyqOyNEtNpQaN+2fcrx+6YGmVo6Sy+W+.YOV9Q947B15o4NJx2+sf5d7DIPplSrYCret.iuGwjCbNEuZpbKkrBPtDluV3uf+xL1NmvTYrctQjW9RA6sreq+FFqJDlh5P+nu.fJNvrkV.uqPAIfj6CBJCwdw7W3k9EZJrdEsF.kL8+6tp16njcJ9nLa6VMagBAtpW34otHbSnBO4Xt8EHl6bAhYkKPL28BDy8t.wb+KPLeyTiQ8LgUSj7vzgjfhdaj1XYsQQiUEzeCvPyfb
-
First thing, in the property editor for the "Shape" Panel itself, the "popupOnRightClick" option should be disabled.
Next, on line 25, "shapeLabel" should be "ShapeLabel" capital S
There should be a period after ("popupMenuItems") and not a comma
Then adjust the substring amount accordingly (change 7 to 5)
-
@Tania-Ghosh Here is the code...
const var Shape = Content.getComponent("Shape"); const var ShapeLabel = Content.getComponent("ShapeLabel"); inline function onShapeControl(component, value) { ShapeLabel.set("text",Shape.get("popupMenuItems").split("\n")[value-1].substring(7, 15)); Sampler1.loadSampleMap(sampleMaps[value-1]); } Content.getComponent("Shape").setControlCallback(onShapeControl); Shape.setMouseCallback(function(event) { this.setValue(event.result); this.changed(); });
-
Content.makeFrontInterface(400, 200); const var Sampler1 = Synth.getSampler("Sampler1"); const var sampleMaps = Sampler.getSampleMapList(); //popup const var Shape = Content.getComponent("Shape"); const var ShapeLabel = Content.getComponent("ShapeLabel"); inline function onShapeControl(component, value) { ShapeLabel.set("text",Shape.get("popupMenuItems").split("\n")[value-1].substring(7, 15)); Sampler1.loadSampleMap(sampleMaps[value-1]); } Content.getComponent("Shape").setControlCallback(onShapeControl); Shape.setMouseCallback(function(event) { this.setValue(event.result); this.changed(); });
-
@D-Williams23 Oh !! My silly mistakes.
Thank you. :) -
@Rudra-Ghosh Thank you :)
-
Here is another version with Paint Routine and Look & Feel
Content.makeFrontInterface(400, 200); const var Sampler1 = Synth.getSampler("Sampler1"); const var sampleMaps = Sampler.getSampleMapList(); //Look & Feel For Popup Styling const var laf = Engine.createGlobalScriptLookAndFeel(); laf.registerFunction("drawPopupMenuBackground", function(g, obj) { g.fillAll(Colours.blueviolet); // Create your own }); //popup Menu const var Shape = Content.getComponent("Shape"); const var ShapeLabel = Content.getComponent("ShapeLabel"); // Paint Routine Shape.setPaintRoutine(function(g) { g.fillAll(Colours.cadetblue); }); //Load Sample Maps & Change Text inline function onShapeControl(component, value) { ShapeLabel.set("text",Shape.get("popupMenuItems").split("\n")[value-1].substring(7, 15)); Sampler1.loadSampleMap(sampleMaps[value-1]); } Content.getComponent("Shape").setControlCallback(onShapeControl); Shape.setMouseCallback(function(event) { this.setValue(event.result); this.changed(); });