Custom radio group buttons



  • I am trying to create my own radio group behaviour
    Basically, it is an "only one" button style, to which I add a "no button at all" option
    To each button is associated a panel show/hide, and when no button, a label should say so.
    Until here, it's easy and works well...

    But it doesn't work with user presets, or when recompile.

    I tried two different approaches:

    • array with one callback
    • 3 separated callbacks

    Obviously, it appears that the last callback, or the last element in the array always takes over the rest when reloading the interface...

    Here are the two approaches, the second with arrays would be prettier:

    HiseSnippet 1374.3ocwX0saaaCElJILv1KdsEXO.B9JGfrTao1tgMLLW6XWDr7iQbZv.5EEzRz1bQhzPhxIdEAnOB6QX2MTrWhb+dI1ivtb6JORQIKYG+ShSxl7EI7b32Qe77C4gpoGyB66y7.ZYOcXeLPaKXqgTduZ8PDJX+8.ZOEZE3yYtmfrIrpbJn5v9HeerMPSa82HmkV1M.gO+02WE4fnV3DQ.vYLhE9.hKgmHsYkef33z.YiOk3lZ1unx9VLZMlCKPvn0gk.8QVmi5hOBIm1ZPf1l0sIblWKNhi8AZaTkYOrUO1ET07Oi3SZ6fkCJCZILjRbClisjwRofZ8HN1MiW49.gUZl3GVW4G9B3gDaxX4o8GRE5IHR6OzVaQzqbZ5U51SOsTzaCE8dFrkkGoOOQijaeFbeJG60AIBAookZtf03Yf0XhYP465hNG2vSLXLhhupToczeYoRa+s4yIllOyAuqkCF4UTJQ9SDb745CPd5UC3bFsr92oGavtXdMlaeFULnXgH8EjHmFkwRPYLSTlKAk4TnZhnXmx5yEkR+r.YrDPFyBj4R.MM8N.0dgzSouPrm+4OWuFxwosnbP+j56kOGg5PnX8NATKNgQ0YzHWtzbdLmhVw1ZGw6yI.uc9beHetrjN5EUikizEOQ+Q7FX7dXO81bpu9wMZDIOJlrqOlelDWwv7iPUQdKophEFnRsKridGjiOd7jhhNyEu4RvmPudDartizuDIS4itsv8EkgJeWxKu7Md4bufDv4xdkNVXMcouZJhrTKMGdDRikuJT7PPf74tRUOtnpLI5n.ebZRwoyHlUpT0Cda84mKYrp4RQu34FyK+eSNycH+XNoxKMa3VUBbu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lmls30OrISRGkdYmh2nPgKqm3PuC32vB++LXQ3e4ugVB72xB+5mrH7QWVbJ7KXvubB95JSM7EbMUoVniGYg9Eca1Gdkzk8ySb8PI8D00HcghpgL9.TD4X5d7NgTnXWcQmiSSryxMxnRwIoh9hCITwbcE6WTCrnRyiZ9JlubXNO9olCorACyuP6EGMm2k4RaXK9+AMa79jlooDWglohW.MK7Vn4VuOoYZl0Un4rR3toL416Fd0NPPjPhxSYfann2m3ZKx9c9q22N4NHkktN+K37oLz04lNYG4YNY3SbMoeaGJdUDMD0afEwQn+YRhqCu+9ub4Lbm+3hK0h0GI47qt5NlUTGF2ExxMUiU9Jcer0yTombHbNJUsdhlRpp0fwfo00lbrHD3kZLrITdPrhpwiz1rEzKDoJEy8o27FC4QSOpBLvjvONfHmbJJ0niIJfdZSLthZjDdDSdp8nkePFs55R2a41gI8FNa9txL3KzS4CMeSFTsr6t86S8j4jcM21+3G9oRQOQDqpi1mHCYPYjKjhzExF7n.S3p60oJWVQUdZVWO8bjtTtudwkvmDkal1SVobyTknQDuPwK7Lc3UiBWPKA3DW+OBTzce0Zb90IbquQczHXB8W34oBEeNv8YaSikvlsVBat6RXy8VBat+RXyWrD17kKzF0eNxCig4JMkIffN6ZNQyYWNAxxzYjn+CPnnX8U
    


  • @ustk Why don't you use radioGroup ID? You can set it on the Component Specific Properties section of the buttons.
    When you set the radiogroup ID the same number for all 3 buttons, (for example 1) you can use it easier.



  • @orange thanks
    I know the radio group, but unfortunately it doesn't allow you to have "nothing", you always have at least one buton ON
    I could use 4 buttons, 3 for my functionalities and 1 for "nothing", but...

    It would be cool if @Christoph-Hart could add the option to switch Off the On button of a radio group



  • @ustk Can

    "isMomentary": true
    

    solve your situation?



  • I do this all the time, pretty simple. When one button is clicked just turn off all of them except the one that was pressed.

    HiseSnippet 868.3ocsV0sSaCCE1osAslshFR6hcYDWkpxPs72lD6GFkxT0FP0JCMIDh4l31ZQhcUhCaUHdQ160dO1av1wwtj1R.QlzxMIme9N96b7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omentary means no possibility to "unselect"/"have nothing"

    @d-healey my problem is not that simple, unfortunately. When you associate a behaviour to both value and !value, you encounter problems when the callback is triggered at compile time or preset change, even if the buttons themselves a perfectly working... see my snippets above



  • You could just disable saveInPreset for those buttons. If you want the last one selected to be remembered then I guess you could reenable saveInPreset in the button's callback (I haven't tried this). If you only want a particular one to be enabled by default then just enable saveInPreset for that one button or enable it manually in the on init callback.


Log in to reply
 

8
Online

474
Users

1.6k
Topics

12.1k
Posts