HISE Logo Forum
    • Categories
    • Register
    • Login

    Scripted radio buttons with the tabbed view

    Scheduled Pinned Locked Moved General Questions
    8 Posts 3 Posters 353 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.
    • FortuneF
      Fortune
      last edited by Fortune

      There are 6 buttons (I don't use radio button ids) for the tabbed view. Tabs are working but there are 2 issues with this code:

      • Scripted radio buttons are not disabling each other.
      • How can we set always Button 1's page (Panel 1) as always default for the init?
      const var NUM_BUTTONS = 6;
      const var buttons = [];
      const var panels = [];
      
      for (i = 0; i < NUM_BUTTONS; i++)
      {
          buttons[i] = Content.getComponent("Button" + (i+1));
          panels[i] = Content.getComponent("Panel" + (i+1));
          buttons[i].setControlCallback(onButtonControl);
      }
      
      inline function onButtonControl(component, value)
      {
      	local idx = buttons.indexOf(component);
      		
      	for (i = 0; i < panels.length; i++)
          {
              panels[i].showControl(idx == i);
              buttons[!idx].setValue(!value && value);
          }
      	
      }
      
      
      HiseSnippet 1105.3ocyWstSabDEdVCaJ1stJQpO.CnpHiH0xFvNUhRqKFnxp0fUrAknnHz3cGyNhwyXs6rDrRQpp+nOO8souF8Mn8L6EuiIFRvT2V+CDmKey22blK6Y53KcnAARejU9diGQQVelc2wBkWSOBSfZsOxZU61gblZDmh6Q5Gf6QCT3MwCj935QdP6MdDIHf5hrrV5GzvrxuLJ52e9c6Q3DgCMyEBcpj4P+I1PlJyamF+HiyOj3R6wFZj81MZ4HEMkbYHHwkrqfFQbtfbN8HhNsb1HqGcfKSI86pHJZ.xZ48jti65IeqHN+SYAr9bp1nJpKLPwtOTxc0JV6E0ziwc6jVJBPvnzIqvrTbg4KraybYS7mUfdbT.bFBy5gUtok2RSIuplxqhg7lgjrLjzxwR5I1cc7YiTYQz54SsaITT+ADnraJk3bQ49ib1MkPFBU4gjKnG5CFSPT540p7LbsJUVemhEJV.J9vp8kDe7Qmz9r8NoWuiOpKdWb8cLB0OTo.Cv8qeyNlXFQDT9D+EzaYJw.yJ6fY3uwbHAGarw5EdWwBX3Wx.9Z1afjS054TUS4vQRAXTZs8hRYM7FvHtQ000pUiLlw6BXGcFuGtLFKGnSWn7k7lDNuOrcqjTDSWh+02ov0PsgI3LAEOHT3nXRA9FYUxIkzmAECdHc8h54WdtzgvwL2q.IlPaYlvkd0wCxf.TjOOj7MKYwyuxbp3bkWbQKdBjT4lpFTN.1mkplHB2EyfQNMwzI8pPrn48oZYVZ0H0he5SSjcLfqA0Tr.7Wi46QRE8XQIXcqPdnjfuYnAClYrDIwo9yLr9F.+6BXIQ3v9T+zxZZhvwhoOqYe6m0LuJvIdehQhRQKASc7Hp31tf.kr4BNW9nDUAophNU94ImJi2MfXvgu71wFUQQRVeZDcOfsYJrrKQuOv25gAe6GF7ZOL30mA7SZsOQQz2IlrL.KMin9JldU2Ze5kvGXhugLu89zfKTxQvG1lbI.rl8QrRcUFk61X7DC7O23sLWkWVzW0vixN2y3qYeaCz8hrMMH6WHKXx1xjL4BlrsMH62ubASVMSxtdASVcCxd4u9fHakXxJl90b882Qbshcz+O0dw0LnB8k2fJue6lT8320nuz2k5+BhKKLv7XzkoWGFcYzD07Ie.0r4hQM2mBxV+qVP9PpY6+WolZ2pZV6+.0TewWad+1hgFxktgbhZ5tz0OMII.zNwTsFqa+UDvTiMe5x+Xst+wJwmX2gob7lsFyMCMBeAbQnwjG7Tz9fACnNpLAtr8gubw75FzKjgJl371DkOC1xXeT3vtva9bn.6Bc+rfOqb5qIhsqns0UftTgajweA+RBVUaakDrZZPzPhiu7Lm3dOzOoZkHOflDQulLucasMdRWZ11UJWAMDdc2YNN5o+WA8BNaLaNGX1ZNvr8bfo1bfo9bf44yAlu9NwneX82GpjCiON.N5bPTqeVVGHHvNqncgn+FWulL6B
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Fortune
        last edited by

        @Fortune

        How can we set always Button 1's page (Panel 1) as always default for the init?

        Did you try enabling saveInPreset on just that button?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        FortuneF 1 Reply Last reply Reply Quote 1
        • FortuneF
          Fortune @d.healey
          last edited by

          @d-healey said in Scripted radio buttons with the tabbed view:

          Did you try enabling saveInPreset on just that button?

          No, I didn't but I will. If it works for default mode that's great.

          But I think it is not the solution for the scripted radio buttons for disabling each other, right?

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Fortune
            last edited by d.healey

            @Fortune

            Replace line 21 with buttons[i].setValue(i == idx && value);

            Also you'll make things simpler if you number components from 0 instead of 1.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            FortuneF 1 Reply Last reply Reply Quote 2
            • FortuneF
              Fortune @d.healey
              last edited by Fortune

              @d-healey Thank you! I started naming from 0, instead of 1 and edited line 21, Great tip, now it works like a charm :)

              HiseSnippet 1084.3ocyWstaZbDEdVr2VCsTkH0GfIVUQfbJBrMNUh3VJX6JTKXT.akpnHqgcGXG4kYP6NKwnTKU0ezmm9rzmj9Fzdl8B6.Eamfpcy9CDmay22b1yY1yz0SXQ88EdHir8mMghL9bydy3RmlNDFG05HjwSLaG3xjSbo39jA939TeIdW7PgG9fPMnFylP78o1HCiM9AUXFY2DE97WeWChKgaQSUgPmKXVzehMlIS01s9OxbcOgXS6yFq4890aYI3MEth.fhaXVFMgXcIYDsCQ4VFSjwmbrMSJ75IIRpOxXyFB6Y8bDukG4+4Le1.WpRnBpGrPQpOQ3ZqXrRKpoCy0taRpvGAqR2zDyFQIluzrMylMWeZB5QgFvoQnmOLxrH81XA5UQmdk0n2JnjgFk1LhRO1rmkGahL0hhOelYKtj5Mj.occpD4KJyelwro.7fKKMlbI8DOPXdDEdd0xOCWsb4h0xmKeNH4CusmR7vcNq8EMNqe+S6zCeH9fZZlFDHkf.n90uoldLSHbp6b84TkLEXfX4ZXF9E5KInXmcJl6c4yggm3E70r2.Nmv0QTYSw3IBNHTX6FgtrMdGXEKp3pJtH7tsv5p7XonRQqjuxYtzS31j35N.J0JH3QPEquXsbWC4EF2kwo3gAbKISvwK4UAqDHeFjHbCnEyq1aYcEVDWLy9JffwvVhwsoWc5vzP.HxlEbd4zUztqjKkOR5Dkvh1.wYsEx.k7gZrD1DB3gXFrxINt3l9bEGUXcXH4d5SiYcj+WCjIeN3WssaGgjdJu.7JKWVHifW1zvgqzVLibodqzrp4261Br.OX7.pWRVMwQniXw1LyatMS+T.qnhDMGE7Vbl7zIT9Mc1.JtxR0RFyJvUYXC4WD2PFULfXPeWVyHgxnPJCAkAcVqiHRRxB.qEr9SndRlh5FGQmBGPF0gm07Hp+kRwD3f44kwvYduGvcU5onGVe1bA7uT+sLaoSp0ettCkMxQ6z3usNRCrO8NAqhFX+J4CFLexTZKdWOJTIpNn5CC7c0AW7.C9dZf+GSefAeecvu9AF7pZf+pe69.77IecSclVH1aYF9+Eps2VCZzWsDzN+9xP+n2Uefvyl58RhMKvWetDcJr0cPgJ2OTXZxwTKlPtK1r6GUrYuOpXy92Ha19+A1T89O27uGSDFPUXG3RjKN0pZT8XCv2XWXTQ03fbelbl9n7+mMJ66KEerYWlzxY0bLyJ3H7E06CNFeAf7lGObH0RlRvMMO4U2OS6idoHPx3iZSjdLnjwrSv3dvcfrn.5b0LdfNXRBUngxkUxpLPOJ2NT3ugmXiUTxFwFqjXDMlX4ItvJZFF0UL1JTCvId3sqxZ1VIiqjL5hoY4RkQiga6bgkkZ6+0v.RqNlcWiX1aMhY+0HlpqQLGrFw770Hlu4ViQcQyuOPJFG0N.J5db3njFFGyIPkUXUH5e.CAM+0A
              
              orangeO 1 Reply Last reply Reply Quote 1
              • orangeO
                orange @Fortune
                last edited by orange

                @Fortune By the way, you don't need to enable saveInPreset for the button to be the default.

                Just set all of the tabbed buttons saveInPreset disabled, and then add onButtonControl(buttons[0], true); function line (Let's say the first button needs to be the default on load), then this function will be executed while the loading of the plugin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qVegmC06UDGVfu9bI5TXq2CEJ+vPgoIseVLg79XydePwl8+fhMGbmrY6+GXSkG9byeeLQX.UgSfKQt3TqpQ0iM.e6bgQEUiCx8YxY5ix+e1nr+So3SM6vj1iVMGyrBNBeg8gfiwW.Hu4ICFPskoDbSySe8Cyz9nWIBjL9vVDoGCJYLaGLtKbGHaJfNWMiGnyHipoUjrkRVkA5R4NgB+I7DarrR1H1X4DinwDaOwU1QSLothwVgZ.NwCucUVyVJYbYT3TTPblVkrPiga6bkssZ6+kvfOqNl8ViX1eMh4f0HlJqQLGtFw7h0Hlu5diQcQyuMPJFGcb.Tz4jvQKMLNgSfJqvpPzeQrs9uJ
                

                develop Branch / XCode 13.1
                macOS Monterey / M1 Max

                FortuneF 1 Reply Last reply Reply Quote 1
                • FortuneF
                  Fortune @orange
                  last edited by

                  @orange Great tip Thank you!

                  you don't need to enable saveInPreset for the button to be the default

                  Is there a specific reason to not doing this?

                  orangeO 1 Reply Last reply Reply Quote 0
                  • orangeO
                    orange @Fortune
                    last edited by orange

                    @Fortune When the preset is changed, this button will always change the tabbed view and that might be boring if your preset browser is already on the tabbed view.

                    With this way, the button0 is always true on the plugin load, but at the same time it's not changing the tabbed panels with the preset change 🙂

                    develop Branch / XCode 13.1
                    macOS Monterey / M1 Max

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

                    37

                    Online

                    1.8k

                    Users

                    12.0k

                    Topics

                    104.7k

                    Posts