showControl behavior



  • Hi there, trying to get these panels to be shown exclusively. I mean if panel1 is open and you click to open panel2, panel1 closes and button1 backs to initial state (not clicked).

    And if I just click on any button and click again, panel behaves just normal (showing n hiding on click)

    Any idea?

    HiseSnippet 971.3ocsV0raaaDDdWYwfP1pfDfhdlvmjARMnXyOEHsnrR1tUn0NBUoF4PARWStxZgI2kfboSTCBPeZ5yQdV5SPuzypyxkTbkCkgT+g21Yluc93L67yjLQHMOWjgv1uXQJEg+XqoK3x4ilSXbz3iP36YcJIWRyb0hFtHkjmSiPX7deqR.1tKp76O+5gjXBOj1HBgNWvBo+.KgIajlF78r33SHQzWvRLr9QAiCE7QhXQAvm8r7PojvqHWROinLqiEBemiiXRQ1TIQRyQ3tCEQKlNW7Zt19yY4rKhopCCPSgKRK9DQbjhwJonQyYwQSp+uyQvsLoIJrmNJ7IVmxhXqj2DMteoB2FDlwCbmaidCLomWqzyqM5gMnWWM8df0zvLVprQihaej0XNjnlQfTfIsz1h57WcrFI.K3xCSHWQOICNrBQ+m348P2G64cvy54zyARD4R2qIYtSHbZ7.2uxsF6kT4HQRpfCG5uuV89JT2.i+siweesm54v3wLN0cVAOTxDbWAeXgTJ3CTnyDw8Cqg9P31iKnGzy4s8bbgOs2OLGhw0Fqs3YZ8s6+pqe+CNLmJOWYeCJaErdNuqhaalc9aI67+mwN+VYmhZqwvs3Grx0iHwwW.0S8uY3UcuaAS1z03abMFAoyDR5y48Ov4sN1Nu6CzLaVapptpXZVaZUcKxtEX84EIWPypSCU1AEMqWUZs4pRylFg5PhggB9XNS97TJeSsRPUwQnpsSEo.Skk0r2qplUG0PLnzz1pJSfJYrYeSzN.2uE3+z3iHRhp6QEk.ZlRyjLUD.eD8ZnsrtWhs0Qz7qjhTHPsJ2CcZ2BV+lUt78SBVz3+uK30rH47FA+RvbJ6x4Fy.9x.jgybzNqWcaMUcSoutqktB2vU+1PCWE7y0txBa2AgpciE9O.sLIModbh8cpCMMR8MEKouQ1X7xkKoJoWW+3.u2tPXeSBGXP32+xFB+oqQ3eGzdgHKhlMk8qFIy6Gbyeikds9anEuAB2cKdEYjNYqmNQe3HHXPnHpHlHWe5nZkfJEPs4ZigTiZ34L4ByUF9WOxr0xvsjtOvZBSFNuc91oE9ppq+eluUKfzy53YyngxFx105jW9e61FsRkeTTHY7KOkHyXvCBqyJRlBuwBo.S3vKaUCTbGUCJ8YO0YUjYJkGUd.JcVVobf5LtR4fZknDRXl3Ug5NbpUbtaoDfS7xM8rgUNgytq5Kp3cBr20qBCUAhOCXd6H72YDe9Ni3Q6LhGuyHdxNi3o6Lhu3VPnVx8aJjhDcYAHXxwkCTv3i4D3UU4KPzeWhlNsG```


  • @hisefilo try this!

    Content.makeFrontInterface(600, 500);
    
    const var Panel1 = Content.getComponent("Panel1");
    const var Panel2 = Content.getComponent("Panel2");
    
    
    inline function onButton1Control(component, value)
    {
        Panel1.showControl(value);
        Panel2.showControl(false);
        Content.getComponent("Button1").setValue(value);
        Content.getComponent("Button2").setValue(false);
    }
    
    
    inline function onButton2Control(component, value)
    {
        Panel2.showControl(value);
        Panel1.showControl(false);
        Content.getComponent("Button2").setValue(value);
        Content.getComponent("Button1").setValue(false);
    };
    
    Content.getComponent("Button1").setControlCallback(onButton1Control);
    Content.getComponent("Button2").setControlCallback(onButton2Control);
    
    


  • @hisefilo Yeahh! it's working. You are a genius man!



  • Hisefilo, or what happens when you work too long in Hise… 😡 πŸ˜‚



  • I did the same thing yesterday... posted help in the scripting forum... and then figured it out! πŸ˜‚



  • @hisefilo We all do this - https://rubberduckdebugging.com/

    Here is another method. It uses the same principle as your code but can be expanded to include many more panels and buttons and would only require you to change 1 value.

    HiseSnippet 1162.3ocsWEtaaaCDlxwpnVqtnEXO.D8WxHcI1YscCHMnp1IYwXMIFyoAEnqHiVhxhHxjFRzowsH.8QZOB4QZuAYGEkrnSbBh+Q7OL7c7938w6Hu6buDgOMMUjfrpczzwTj0Sr6OkKi5DQXbT2sQVO0deRpjlf0pZOcLIMkFfrrV4OTJrpU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viiV8sP7p2iaUFoW17oWzM6TCyKHBlDSjyODgZxo7Ef2py0sV0QlmxjSMmr5AYxh6KcetcOlzOZw7sxB3q5c9CLeymSqt8NggTeYIYqZu6md3GJC8WhIRFe39DnK.bgv9fIi5C2w7o.S3pFPfNqJpBVZ4lJYUjoOkGjI.OgtJewVJYq7EaUrHZDwOQbRded0jfONSCvId1.w0fIyAY7r5jJdOBFO8DeeUf3W.luXDarzH90kFwqVZDudoQ7lkFwuszH986.g5+B79IRwH8yBPQucxZvXYsCm.2pxtAh9e.HjLlMC
    


  • @dustbro a classic!



  • @ustk true πŸ™‚



  • @d-healey hehehe like that website. Cool snippet! Saving into my snippet folder πŸ™‚



  • Is showControl(bool) more efficient than the set("visible", bool)method ? I'm always using the latter...



  • @ustk I'm pretty sure that they are equal in terms of efficiency. It wouldn't suprise me if showControl is just syntactic sugar for set(visible) or vice versa.




Log in to reply
 

9
Online

502
Users

1.8k
Topics

13.6k
Posts