Label for user preset name - get name when session reopened?

  • I have a plugin that displays the name of a preset in a label.
    I'm using:

    Label.set("text", Engine.getCurrentUserPresetName());

    It works great while the session is loaded. When I close that session and reopen, settings are all correct, but the label is empty. What is the proper way to recall the preset name when reopened?

  • @dustbro This is how I usually do it...

    • Add a slider (call it “Knob1")

    • Add a preset browser

    • Add an empty label (Call it “Label1”)

    • In “Label1”s Component Specific Properties, choose font and font size to fit with GUI


    const var Label1 = Content.getComponent("Label1");
    inline function onKnob1Control(component, value)
        if (Engine.getCurrentUserPresetName() == "")
            Content.getComponent("Label1").set("text", "Init");
            Content.getComponent("Label1").set("text", Engine.getCurrentUserPresetName());
    • Make ‘Knob1” invisible and change name of “Label1” to whatever you want, but make sure to also change all instances of “Label1” that appear in the code to that exact name

  • ^ This and remember to save you project with the preset you want to be the initial preset.

  • It almost makes sense to me. So the label text is dependant upon the knob's position ?

  • @dustbro Nope. You need something to trigger after on init. Since all control callbacks are triggered after on init (if they have saveInPreset enabled) it is possible to use this to trigger the code to load the preset. You could also do it with a control you are already using or with a timer callback.

  • @d-healey aahhh I had almost identical code as you guys, but a momentary button was setting the controlCallback. Linked to a Knob and all is well.

  • @d-healey I have a problem similar to this I think,
    I have an array with 8 panels and an array with 8 buttons which are in a radio group.
    The values from the button group control which panel that should be painted with another colour (paintRoutine), so I've set it up to work fine but on init all panels are painted in the same colour, even though the radio group buttons and the 8 panels have "saveToPreset" enabled.
    How would you solve that problem? Is it possible to do something like you did in the video above or do I have to go another way?

  • @ulrik Think about it this way, if all the radio buttons are set to saveInPreset enabled then every single button is going to fire its callback after on init. So if you only want one of them to do that you need to disable saveInPreset for the other buttons. Another option is to just set the button you want to have enabled manually after on init completes.

  • @d-healey there is no problem with the buttons, they remember which state they are in when opening the plugin, the problem is that the panels is not taking the values from the buttons (which make the panels repaint) on init

  • @ulrik Can you post a minimal example?

  • @d-healey This example is not exactly as the original but it shows the issue I'm having.
    I can see what you mean when you say the buttons will fire off each buttons callback, it's very clear in this example 🙂

    So I want the buttons to remember their last state when reopened, and I want the panels to be repainted with the value from the buttons, how?

    HiseSnippet 1313.3ocyX0uaaaCDWJMJqwatXEXO.D9ujCxGx10Yannqo4qtf0jXTm0UfffBVIZahHSJPQWGih.r2g8h12fs6njrjSbRrcQAF8+n6Nd28i2wiGoaoj9r3Xoxxd0yFEwrr+Am1iD5d60ixEVGsuk8SbNlFqYJRBqcGEQiiYAV11O50HC6UW1xL9xK2kFRE9rbVVVuSx8Yug2mqy41Zm+fGFdHMfcFuegY+rcNxWJ1SFJG.34QNdVQT+KocYmPwosjik8JGDv0RUaMUyhsrWdWYvn18jCEIy+c7X9GCYHQMq1fgRXenLL.QLx0Zud7vfVYq6XKvJsxiBOJIJ7SNGyC3i4mGM9Qi.RtFEiG1Kcevq1CCOuoAO6Bva4D38Tm19JdjNWBhsu24HAjn5PgTPQXkLWqk9mUb1SByPn2rO8R1gJfXrFta64sNoomW0mWtzVaQHux2WpB3RA4srtbyNf17thXBLdwbM.6sV4RmAtLln6wH9lLLoiR12PWAVFQLkdDII7Uobo01JADmoXP.adc3c.Bvd6BAEIrj1XVGkKAaIi0jOQUYJCgCLPPdAoy.guFhPtcqR9b4RXjAm2PPjtGOdytL8ewCz8bwXZlzdEj96Ld2dZi3U6tYLSmr42MStaEtl0OgYkpoSKPQGdPXHOJl4d9PxZDuM8ZrNX2ruFR1fjxeaj+FYx19h0yDznfwdCWvbS42bB0alX1Za0fT7qEwF0Gai521FXpIPpiS9LTNjoLVtCbNwMVpM8twpaMRys1NeM9qiscslYAkZMu.cy0kKg+JjP0v14WPNOqpnKl.5GIE.gaEPZsJUWOIyM43NUn97pPiJUu34ShpVhv6AUsnBV37gKiJ0meUFisNRkaDgKLPqZ4Ro60ivcrsfSF0uUNPia.lrBo5ySB4bQHHbb0BQJv.O5XkLz0OyqqCq9vArb6GJ8ogfaCXWAwCTmMMDm1IWorJKvZwxP1lQJ.NtlokIBQueAzi79bdnvGWESTnsNoh2UGlNpjYlj4pXQ3BFJYMLuNQFZ4yMN8h61ZdvXr0JpQAadcV31.XbImGN7SNfvD01iFF9Qn4n6DwxLCb6rbgX+IRM6Tga0RetzpkttzsD0oyTkk5hPlZphwN4p6SQWwf9ejoxRxYSDZoMYOyUlsdl9IaaKLQo3HAWeZDKk99a5aktuG5utRJBgopMcWKm0cEKBr3fMdrSRYmkA7Euei0Lqb8uFkaLCJ+jTk2cfVKEFsWwAOD6l59kWNy5V+qvuSCy+4Q6S0T7RMow+zV+bL0auO6SvsESthypN6yhuTKiLInzpcf8Clhtxx1wF80nrOFh8fQh.fnmokaFUdcJdy27p9BBpCNck+EFnohoehcjnkhAkh.fWxZNfVcDZowh+97cFULv7+DH1nHDu7qBh3ocKBD+tGZy7UEA0nhQzohvr49a6nnvsYesRNHJ6PgY1q2Yp6apWuyrwB30a+FB3kLxfAgT8jOuAeSWp.376IdGA9VAQLWOp3QIywad7l4mjMqv8oNs3Z+dSGuKME7Bm77sFuoufrryAc5v704fcYmCe+h9bw4.JI2Eq6wTshimEdxf9sgBPeFfDATiGi6ZVBOGOg1K6Xx1LQfg.KSSEVCosSEVKSnUepuR9A+jFA3aTergCfIg4o5q5bLRSF25wwAtZtUe3oyev2GCEa.Xe55TeAzowBnyyV.cZt.5r8BnyOu.57K2qN3+ZwqFnk8SJS.FsNvzJ119.AE1kY1QZ8eb6itVF

  • Oh I see the problem now. Just check if the button's value is 1. If it isn't don't do anything.

    inline function onBtnsControl(component, value)
        local index = Btns.indexOf(component);
        if (value == 1)
            for(c in Pnls)
                c.set("itemColour", "0xFFFFFFFF");
            Pnls[index].set("itemColour", "0xFFFF0000");

  • @d-healey thank you, that solved it, it's so easy to forget. 🙂

Log in to reply