Add Widgets & Panels at runtime



  • Hi, as you might see from my questions I am new to HISE ...

    1. I tried adding widgets like ScriptButtons, etc. to a ScriptPanel or ScriptFloatingTile but did not succeed so far.
    2. After adding those I want to switch the panels on or off at runtime. 🙂
      Making them invisible only would also be acceptable in the worst case and I know how to do that.

    As I cannot find something about this here or elsewhere I guess it's not possible?
    Or does that mean it's trivial?
    Thx!



  • You can't add controls at run-time, at least not without some C++. But you can control their visibility. The command you need is .showControl();.

    I have a video on my Patreon page about making a tabbed interface, it uses this method.



  • @paul

    • create your panel
    • select your panel
    • create your button

    The button will be inside the script panel

    turn (any widget) on or off like this:

    myPanel.showControl(false)
    

    -- Doing Dave Healeys scripting videos is a recommended early step...



  • Dave is right, every UI control has to be declared at the beginning. The reason for this is that the UI controls also act as data model and for the sake of preset consistency you need to have every slot defined (see https://docs.hise.audio/working-with-hise/project-management/user-presets/index.html)

    With C++ you can easily decouple this connection and build up a separate data model which the UI controls act upon (which is what I am doing in PercX).



  • Thanks to all of you!!! I understand ...


Log in to reply
 

11
Online

622
Users

2.5k
Topics

20.3k
Posts