One preset name behind on prev/next buttons
-
When trying to show the preset name on a Label using prev/next buttons, it always shows a preset name behind on both of this example
namespace UserPresetWidgets { inline function createPresetButton(name, x, y, up) { local widget = Content.addPanel(name, x, y); Content.setPropertiesFromJSON(name, { "width": 10, "height": 15, "saveInPreset": false, "allowCallbacks": "Clicks & Hover" }); widget.data.up = up; widget.setPaintRoutine(function(g) { g.setColour(this.data.hover ? 0xFF65B17c : 0xFF2C4433); g.fillTriangle([0, 0, this.getWidth(), this.getHeight()], this.data.up ? Math.PI/2 : 1.5 * Math.PI); }); widget.setMouseCallback(function(event) { this.data.hover = event.hover; if(event.clicked) { if(this.data.up) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadNextUserPreset(true); } else { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadPreviousUserPreset(true); } } this.repaint(); }); return widget; }; } const var UpButton = UserPresetWidgets.createPresetButton("UpButton", 749, 10, true); const var DownButton = UserPresetWidgets.createPresetButton("DownButton", 736, 10, false); // ============== second attemp // next inline function onnextBtnControl(component, value) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadNextUserPreset(true); }; Content.getComponent("nextBtn").setControlCallback(onnextBtnControl); // prev inline function onprevBtnControl(component, value) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadPreviousUserPreset(true); }; Content.getComponent("prevBtn").setControlCallback(onprevBtnControl);
-