Forum
    • Categories
    • Register
    • Login

    IDEA: nullable button radio groups

    Scheduled Pinned Locked Moved General Questions
    16 Posts 3 Posters 106 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dannytaurusD
      dannytaurus
      last edited by

      💡This is just an idea.
      🗑️ It may be useless
      🤦 It may already exist
      🤷 It's definitely already solved by a simple script.
      🤔 However...

      I wanted some buttons to show/hide some panels in my plugin, but I also needed to be able to turn all panels off. Something that comes up often for a lot of devs, I'm sure.

      The button radioGroup feature is almost right for it, but just needs that one last part.

      Since all the code for radio group buttons is already there, I just added a way to set specific radio groups as nullable.

      PR here: https://github.com/christophhart/HISE/pull/823

      Usage (snippet below):

      // Set Nullable Radio Group by ID
      Content.setRadioGroupNullable(2, true);
      
      // Set Nullable then back to regular Radio Group
      Content.setRadioGroupNullable(3, true);
      Content.setRadioGroupNullable(3, false);
      
      // Test invalid radio group ID, console shows:
      // Interface:! No buttons with radio group 99 found
      Content.setRadioGroupNullable(99, true);
      
      // Test wrong number of arguements, console shows:
      // Interface:! Too few arguments: 1, (Expected: 2)
      Content.setRadioGroupNullable(1);
      

      Here's a demo video: https://share.cleanshot.com/v6tfjFN6

      In the video:

      • First row is regular radio buttons. When one is active, then one always has to remain active
      • Second row is nullable radio buttons. Even after activating, they can all be turned off
      • Third row is a test of making a radio group nullable then back to regular
      • Fourth row is regular buttons, not in radio group - just to show normal button behaviour is still intact

      Screenshot of the demo:

      CleanShot 2025-12-21 at 22.28.07@2x.png

      Here's a snippet (the nullable calls won't work unless you have the PR merged, of course):

      HiseSnippet 1535.3oc0Y0saaaCElJIZq1YsnEnC6pAvkap8PVq+owsNaCyM+0YrlTi5rh0qZoknrIpLofDUR8JJPeT1iReSVeD1aP1gTx1Rqxxo1IEq9hfvCO+7cN7vCOjpiuvhFDH7QFEOdjGEY7UlcGwkC1c.gwQs2CYbMyCIARpONhzNi7HA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y7sWk713+5ETy5XWk72hun5VmHTI2Myu97r.b0XU+HROpqVyWwT++Um4l1m0RcHGx3aLeBsenKwOYyU3pHnCn97gQFwzk5HQIs6WNG6Val1kEa2xlY0UGtFtDbRjjAc7bKUiP2pbFH4TlsbvDU9WiZ8w.s5yBZuyOFZ+j44qETb8DfU2oy4AsxVeLKf2clAxQwn8qMgNGvjT.qxbV9JLGqt0LsZ6IoMYEQBxvtNvY7cY+Yh61UqU5Px6CaMfx5OPl75eIgawzvsCgGC2BlPWW4cbeKZqdBeapeZDfPQTUPOLHIcljNb7sNK7EHzYmklZsjjGiZSiaBiR6TnWjxEVeVtv5ZWH+RyKoSbFJSmHlblNgowagAmLt8uzEclouTT6K4dt1x4J.fyxUFSdNqGKj6jaeAu26yH2QmokeiUKo+7oKSSuwOulRWVOYo13uPdSdMKgO8+edSwbyyxuYyk0eV37ry+99baOeIw+m1885rq7ZM9Eu4yn8J5rq7aGeY8mOsmWla6+Koqbwkn8gOo70MOTXCWbPl9EtUeGf3IXhzeh.0SSxCXxQIeThKrm897BwaX1gIsFjMFWICLhPWJXL9iEbUy8cbnVxo.bMyC9iKmuL.5IhP0sUNjH8YPFGzC+vtPRgEErNGxJUOAnwJpxjQiqnFqh.coba8fyfewSVUM1HdxpimDMjX4KdtUzCOp9bDWQSAvDW+oaJXdnZLbES8iQlLNOjYydtkUZU8ABVaQEr9hJ3cWTA2ZQErwhJ38VTAu+7ET8wqdPnTLLZaCBcXm80ujqgw9b0UA0Yqn+EXWJL4H
      

      Meat Beats: https://meatbeats.com
      Klippr Video: https://klippr.video

      David HealeyD 1 Reply Last reply Reply Quote 3
      • David HealeyD
        David Healey @dannytaurus
        last edited by

        @dannytaurus Seems like a useful addition to me, this is behaviour that I often have to script.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        dannytaurusD 1 Reply Last reply Reply Quote 1
        • dannytaurusD
          dannytaurus @David Healey
          last edited by dannytaurus

          @David-Healey Do you think the Content.setRadioGroupNullable() call is the right way to go about it?

          Since the radio group itself isn't exposed in any other way, I thought a high-level setting would be best.

          Meat Beats: https://meatbeats.com
          Klippr Video: https://klippr.video

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @dannytaurus
            last edited by

            @dannytaurus Yeah it makes sense, rather than having to apply it to individual buttons. I don't know if nullable is the most intuitive word for the behaviour.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            dannytaurusD 1 Reply Last reply Reply Quote 0
            • dannytaurusD
              dannytaurus @David Healey
              last edited by

              @David-Healey Good point. Any suggestions?

              Meat Beats: https://meatbeats.com
              Klippr Video: https://klippr.video

              David HealeyD ustkU 2 Replies Last reply Reply Quote 0
              • David HealeyD
                David Healey @dannytaurus
                last edited by

                @dannytaurus toggleable... lol don't use that. I can't think of anything better at the moment. Maybe someone else will chime in a with an idea.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @dannytaurus
                  last edited by

                  @dannytaurus That's usually made on the scripting level so having this at a C++ level seems a good idea 👍

                  setExclusive
                  allowDeselect (my preferred one)
                  setDeselectable
                  setExclusiveZeroAllowed

                  Hise made me an F5 dude, browser just suffers...

                  David HealeyD dannytaurusD 2 Replies Last reply Reply Quote 1
                  • David HealeyD
                    David Healey @ustk
                    last edited by

                    @ustk said in IDEA: nullable button radio groups:

                    allowDeselect

                    Yeah this seems good

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    1 Reply Last reply Reply Quote 0
                    • dannytaurusD
                      dannytaurus @ustk
                      last edited by

                      @ustk @David-Healey Yep, allowDeselect is good, but not for the whole function name surely?

                      Content.allowDeselect() ?

                      I should refer to radio group, radio button, or similar, right?

                      Meat Beats: https://meatbeats.com
                      Klippr Video: https://klippr.video

                      David HealeyD 1 Reply Last reply Reply Quote 0
                      • David HealeyD
                        David Healey @dannytaurus
                        last edited by

                        @dannytaurus setAllowRadioGroupDeselect()?

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

                        ustkU 1 Reply Last reply Reply Quote 2
                        • ustkU
                          ustk @David Healey
                          last edited by

                          @David-Healey said in IDEA: nullable button radio groups:

                          @dannytaurus setAllowRadioGroupDeselect()?

                          yep much more better

                          Hise made me an F5 dude, browser just suffers...

                          dannytaurusD 2 Replies Last reply Reply Quote 1
                          • dannytaurusD
                            dannytaurus @ustk
                            last edited by

                            @ustk said in IDEA: nullable button radio groups:

                            @David-Healey said in IDEA: nullable button radio groups:

                            @dannytaurus setAllowRadioGroupDeselect()?

                            yep much more better

                            👍👍

                            Meat Beats: https://meatbeats.com
                            Klippr Video: https://klippr.video

                            1 Reply Last reply Reply Quote 0
                            • dannytaurusD
                              dannytaurus @ustk
                              last edited by

                              @ustk @David-Healey Actually, maybe the 'Allow' is redundant, since we call it with true or false.

                              Maybe just setRadioGroupDeselect, like this:

                              Content.setRadioGroupDeselect(1, true); // turn it on
                              Content.setRadioGroupDeselect(1, false); // turn it off
                              

                              Thoughts?

                              Meat Beats: https://meatbeats.com
                              Klippr Video: https://klippr.video

                              David HealeyD 1 Reply Last reply Reply Quote 0
                              • David HealeyD
                                David Healey @dannytaurus
                                last edited by

                                @dannytaurus I think the allow is good because we are saying "allow buttons in this group to be deselected"

                                Whereas without it we are saying "set buttons in this group to be deselected" which has a different meaning.

                                Also there are other similarly named functions

                                1314f686-983d-4388-b2d1-a3d70ced7adc-image.png

                                Free HISE Bootcamp Full Course for beginners.
                                YouTube Channel - Public HISE tutorials
                                My Patreon - HISE tutorials

                                dannytaurusD 2 Replies Last reply Reply Quote 0
                                • dannytaurusD
                                  dannytaurus @David Healey
                                  last edited by

                                  @David-Healey Nice. I'll update the name now 👍

                                  Meat Beats: https://meatbeats.com
                                  Klippr Video: https://klippr.video

                                  1 Reply Last reply Reply Quote 0
                                  • dannytaurusD
                                    dannytaurus @David Healey
                                    last edited by

                                    @David-Healey @ustk Function name changed in PR.

                                    Meat Beats: https://meatbeats.com
                                    Klippr Video: https://klippr.video

                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post

                                    27

                                    Online

                                    2.1k

                                    Users

                                    13.1k

                                    Topics

                                    113.5k

                                    Posts