HISE Logo Forum
    • Categories
    • Register
    • Login

    Switching panels , duplicate code.

    Scheduled Pinned Locked Moved General Questions
    20 Posts 2 Posters 721 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.
    • d.healeyD
      d.healey
      last edited by

      //onControl
      
      	switch(number)
          {
              case small: handlePages(PnlSmall); break;
              case medium: handlePages(PnlMed); break;
              case large: handlePages(PnlLarge); break;
              
              
              
              // Switch Main to Preset Browser
          }
      }
       
       switch(number)
          {
              case Plusknob: handlePages(MAIN); break;
              case OKknob: handlePages(PrstPanel); break;
              
              
          }
      

      I don't understand how you've laid out your code. The bits I've copied above are in the on init callback.

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

      1 Reply Last reply Reply Quote 0
      • lalalandsynthL
        lalalandsynth
        last edited by lalalandsynth

        @d-healey
        Oh, sorry I just copied the code in wrong.
        So like this

        onInit

        Content.makeFrontInterface(672, 505);;
        
        // Switch Between Small medium large
        ;
        const var small = Content.getComponent("small");
        const var medium = Content.getComponent("medium");
        const var large = Content.getComponent("large");
        
        const var PnlSmall = Content.getComponent("PnlSmall");
        const var PnlMed = Content.getComponent("PnlMed");
        const var PnlLarge = Content.getComponent("PnlLarge");
        
        // Into Array
        const var pages = [PnlSmall,PnlMed,PnlLarge];
        
        inline function handlePages(pageToShow)
        
        {
                for(p in pages)
                    p.set("visible", pageToShow == p);
        }
        //Default
        handlePages(PnlMed);
        
        
        // Switch Main to Preset Browser
        const var Plusknob = Content.getComponent("Plusknob");
        const var OKknob = Content.getComponent("OKknob");
        
        
        const var MAIN = Content.getComponent("MAIN");
        const var PrstPanel = Content.getComponent("PrstPanel");
        // Into Array// I am aware of the Duplicate var declaration in pages, just not sure what to do
        const var pages = [MAIN,PrstPanel];
        
        inline function handlePages(pageToShow)
        
        {
                for(z in pages)
                    z.set("visible", pageToShow == z);
        }
        //Default
        //handlePages(PrstPanel);
        
        
        
        
        

        And the onControl

        function onControl(number, value)
        {
        	/*  This callback just calls the page handling function with the respective page.
            *   The other custom callbacks are implemented in the onInit script.
            */
        	switch(number)
            {
                case small: handlePages(PnlSmall); break;
                case medium: handlePages(PnlMed); break;
                case large: handlePages(PnlLarge); break;
                
                
                
                // Switch Main to Preset Browser
            }
        }
         
         switch(number)
            {
                case Plusknob: handlePages(MAIN); break;
                case OKknob: handlePages(PrstPanel); break;
                
                
            }
        
        

        https://lalalandaudio.com/

        https://lalalandsynth.com/

        https://www.facebook.com/lalalandsynth

        https://www.facebook.com/lalalandsynth

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

          I can't see an obvious problem. Post a snippet please.

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

          1 Reply Last reply Reply Quote 0
          • lalalandsynthL
            lalalandsynth
            last edited by

            HiseSnippet 2499.3oc0Z07abjTEua6TwdlDu3EgPh.KaICKxNx3uxG6l0xjIismvr9qY8LXVAZIt7z0LSi6uT28XGmrVaPHt.Bo8BGhDGrzdLWP7O.9BBj1KbB3BRKm4RNxsvqpp6oqd5Y5o8DhXwmb8wqpeueuW8duplthqccpmmsqhZtZm3PUTuJp5IV9sVsEQ2Ro7ZP+nhj5GhW7NJEOwg34Q0TTUG89rgUycIE9eO+tEIFDq5zntTT1yVuNcScSc+ndqTXCcCiRDMZMcSoYeyBkqaaspsgca.JihVPwA1TRS51D1zFAond400z8scq5S7odJpWpns1IUaYerkX96o6oefAk0XQkpvBI5tjsgFCwrdUVsktgVkPU1SAVkJQDvnBB3qf1RWSuS+QDwj7AvQRHyGpijF7VTFdKjc3oJAuKIf2qipV2U2wOZDF1tBprkO0sAALAxvRLWkQtwXnUsgYX4OmI4PZIWnQGIl91u8Ryhu0B2ZlkWdh7Sje94wUOV2udKbQp+wTpEtpIwv.aR0zaahMHtMoSjGlJXx77wGQbwd7IrB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Sjp9VEFb7puusqGe6d4hylxEF.EPiZPNQnAKEdt6YI0fxIzfuSgzJQMbk68KbzCTN1.eGtnjy+telTx4BROAyOJVLhEyTVA9huw16TLQsO884pfhp1sZsNWcIDHxkL.WRLNC94IJYPonDCNUepHC2vEFOAzFevO7nz6A8XYfsPDc80hQWWKagTg0FyRhtHGT5daYy9kSHtvVnNR1vXzyaFAxIOsOf7ZCDjuYuuJZmv9ofww5eI4L6BzKkJWRdA69348rXn7sFvi+U5BaTCdP2HjblwPyWIq9emCwcpKRNK2nnkxHBkd33HLtu9+EsoU1rsWJnL4Wcwjnsr0ZaP7i+Agv9JXBFfkOP9Kuf80UX4o6G6smek7UhjU395nJreosdi2Q5AdUTdki2fu4lIPq2nAjTMBrWBU5Cd0+A1nrqca1iZrEAbWX4sfKnWEpQqNEPhEDRl8q9AmxYhxauP3O.RUpkFuwKf+BFbQVa0fAWLbPESBbkrGTW7Clv9pdFm2CfIK9Q5bnsXswc9koPnElaAEScM8GTuNiJ9t.16sLKMDxbigPlaNDxbqgPlaODx71CgLuSpxv9NutWaeaSwwDniJqKdOI00sHfWF2iT4+POti1Q
            

            https://lalalandaudio.com/

            https://lalalandsynth.com/

            https://www.facebook.com/lalalandsynth

            https://www.facebook.com/lalalandsynth

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

              It works fine, once I made the buttons visible.

              Edit: Actually only the three work that you already said work. One sec.

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

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

                Ok there are two problems.

                1: You have two switch statements for the different sets of buttons. You should just have one switch statement.
                -- The second switch statement isn't in the onControl callback, so it will never be triggered anyway.
                2: You haven't declared variables for OkKnob and PlusKnob.

                Your naming system is terrible. Buttons should be called button, not knob, and your use of upper/lower case is very random. This won't affect how it works but it makes it confusing to figure out what is what.

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

                1 Reply Last reply Reply Quote 1
                • lalalandsynthL
                  lalalandsynth
                  last edited by lalalandsynth

                  Ok, fixing the naming, planned to change once i got it working.:)

                  So the onControl should look like this ?

                  function onControl(number, value)
                  {
                  	/*  This callback just calls the page handling function with the respective page.
                      *   The other custom callbacks are implemented in the onInit script.
                      */
                  	switch(number)
                      {
                          case small: handlePages(PnlSmall); break;
                          case medium: handlePages(PnlMed); break;
                          case large: handlePages(PnlLarge); break;
                          case Plusknob: handlePages(MAIN); break;
                          case OKknob: handlePages(PrstPanel); break;
                          
                          
                          // Switch Main to Preset Browser
                      }
                  }
                  

                  https://lalalandaudio.com/

                  https://lalalandsynth.com/

                  https://www.facebook.com/lalalandsynth

                  https://www.facebook.com/lalalandsynth

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

                    @lalalandsynth Yeah

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

                    1 Reply Last reply Reply Quote 1
                    • lalalandsynthL
                      lalalandsynth
                      last edited by

                      ok so I need to have another name for the const Var .

                      I would think it would work like this ...I am stumbling through here while I learn :) Must admit I dont know what I am doing.
                      This is the code for the second switch , and still does not work .

                      // Switch Main to Preset Browser
                      const var Plusknob = Content.getComponent("Plusknob");
                      const var OKknob = Content.getComponent("OKknob");
                      
                      
                      const var MAIN = Content.getComponent("MAIN");
                      const var PrstPanel = Content.getComponent("PrstPanel");
                      // Into Array
                      const var pages1 = [MAIN,PrstPanel];
                      
                      inline function handlePages(pageToShow)
                      
                      {
                              for(z in pages)
                                  z.set("visible", pageToShow == z);
                      }
                      //Default
                      //handlePages(PrstPanel
                      

                      https://lalalandaudio.com/

                      https://lalalandsynth.com/

                      https://www.facebook.com/lalalandsynth

                      https://www.facebook.com/lalalandsynth

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

                        @lalalandsynth said in Switching panels , duplicate code.:

                        Must admit I dont know what I am doing.

                        I don't know what you're doing either :p

                        Here's a simple way to do it

                        HiseSnippet 1156.3ocsXssaaaDDcornQDaUPCP9.VjmjfScHYtU.WipZ4Kvn01BUtFFHHHfhbkzBSsKA4R6HD39EzOn9X9b7i8OHcVdQjRlRkhIluXuyMdlyN6NbTOetMIHf6iTZb9TOBR46U6OkIF2crEkgNdejxiUOwJPP7wwh1apmUP.wAonrwQRAJMpihd92eYOKWKlMISDBcAmZS9c5DpHSZuN+F008PKGx4zI4r9UcN1ly5xc4g.d1PUG4YYek0HxoVRypohT17.Gpf62WXIHAHk56wcl1eL+FVr8WPCnCbIxEFn9PfhEeH20QhXoTT2wTWmdo4c.BhRuLVXiXV3opmPcnyjmwF+PjBblG44CkZqBdF++vSuH3ojCd0ig2ST6a6S8DYZjX66TOlAaTCsfsf7vJ1VTs+VUsKGrfI1dh0UjC8gEy7n0az0eN9055s2ooVSMXiHPfu1xG6YwHtAG4yC8Lv6he262YIZMuu1AgBArXYNmW8Luap8hWbDQfGIkhMvf4BetaPSsgbebKJXm9NXJ9mwuD9yVa0to1mZpggm7HcauvfwsRS2QDQW9DONCVz5YdL2HiNiQdFdKLssLkkAXN3tpHLPvJQDdG88aGH8KJA5Z45N.pmawY6EYUrQIZkA310I4MWdxaVlj+7a3KG5lkI4WcDJSxad+jOVaV9m3WSMJykxH3ggLaAErnPVrkcJLeNTf4FRh4mFKRdyUo3RXiDiSoSYhjPoKaC8BYjaMewBk4P93YCy.Pa7t6BbCjYMVr1LJLvsBoftzQRFnaKlpLKKUYVcpxr7Tk4RoJy0gpLWEUYVFpJGIbJWPNi0ps1mzZncqFdQUCGVntjWsKwuP0xVX9qxwVrvICH9orbpgvc4y2rXyx0rvN9LYNC4riYTwYdjj0qtaGJ4PMzXQMAgfohn1JONosRb4Bh5HEk6tNcTTN.8TpgVWeMl46FqsulU0W3JJ8uBeMxku+4w6aIrjsiSHPfT8H9BpbuSYex0v24D2btg59jfqDbOjh1rqMAwwuylostkU4IuxbMjzQeD1XTdJrQMM+WFcC0QLNS.syXBcz3rOp5yC5LXT5mN0XSD5tuDYmfLIS5cnGsfTy7hQ4PqVoPqwbnM9e9lfz6K0Lu3qSOaDsotlf1TB5Ll8gflurXZ9xuRvGUNuDv2g+sA7n65UHymHdIfuQo.uwCN3+mhKaRDmGw0K6UdQU3+kxBmGqPnLJJTe97pDJyBQ0f0NToETKFJcupDpBSPbXGz8GfAFih6D5ZIle1J4.kIJfdnyMDibPEV.ULM+.mqw.W5kddvxB2mn1iJrGWLdqU.dglGOz3MY70lpGLbHwVjA15pGdYUmUcMfxevCET1nSrD9TYwvogS5CmBsI.RXxOqSVfTSdRLdstbsjY5SXNQK9B7jnzPtVIQoQpRzDKae9GRmLBH0GEIAvDK52Ing5Ix03YcuUU02VGMAla+C11Rp3GArWrOlUvmWVAedUE740Uvm2TAedaE74mVoOxexjeMTvmDeLADz6fnulRQ4.lETkEUQh9O.52DH0C
                        

                        You might also find this video helpful if you haven't seen it before.

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

                        1 Reply Last reply Reply Quote 1
                        • lalalandsynthL
                          lalalandsynth
                          last edited by lalalandsynth

                          Ok, will look at that video .

                          I might not have explained properly either.
                          The three buttons that do work , should reside in main panel, then I want to switch between main (containing the three switches) to just the Preset manager thereby removing the three from view.

                          This is what I am trying to achieve, just doing it manually.
                          Although eventually I would like it to be just the one button that opens up the preset browser
                          Switching.gif

                          https://lalalandaudio.com/

                          https://lalalandsynth.com/

                          https://www.facebook.com/lalalandsynth

                          https://www.facebook.com/lalalandsynth

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

                            The three buttons that do work , should reside in main panel, then I want to switch between main (containing the three switches) to just the Preset manager thereby removing the three from view.

                            The example I posted shows how to do that. I just put all of the panels and buttons separate but you can put them inside each other to get the layout you want.

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

                            lalalandsynthL 1 Reply Last reply Reply Quote 0
                            • lalalandsynthL
                              lalalandsynth @d.healey
                              last edited by

                              @d-healey Awesome, thanks testing this.

                              https://lalalandaudio.com/

                              https://lalalandsynth.com/

                              https://www.facebook.com/lalalandsynth

                              https://www.facebook.com/lalalandsynth

                              1 Reply Last reply Reply Quote 0
                              • lalalandsynthL
                                lalalandsynth
                                last edited by lalalandsynth

                                @d-healey
                                Excellent !!!! Thanks so much , I have struggled with this for longer then I care to admit .

                                Thanks for your help an patience :)

                                Quick question if I may, would it need much modification to to able to switch the second group with a bool/one button rather then 2 buttons ?
                                I would like to make btnGroupTwo1 do the switching .

                                Not essential just curious

                                It seems to want to default to btnGroupOne2, trying to hack my way through changing that :)

                                https://lalalandaudio.com/

                                https://lalalandsynth.com/

                                https://www.facebook.com/lalalandsynth

                                https://www.facebook.com/lalalandsynth

                                1 Reply Last reply Reply Quote 0
                                • lalalandsynthL
                                  lalalandsynth
                                  last edited by

                                  I am having a problem with this .

                                  1.When Compiled it always goes to the same window.
                                  2, I cannot get this to be saved in a preset even though the buttons are set to saveInPreset, ...unless its problem #1 that is overriding it ?

                                  https://lalalandaudio.com/

                                  https://lalalandsynth.com/

                                  https://www.facebook.com/lalalandsynth

                                  https://www.facebook.com/lalalandsynth

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

                                    Any control that has saveInPreset set to true will trigger its on control callback after on init completes. So if you have saveInPreset enabled on your page switching buttons the last button that triggers after on init will determine which page is displayed when your script runs.

                                    I have a video on my Patreon page about making a tabbed interface and I'm pretty sure I cover this situation there.

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

                                    1 Reply Last reply Reply Quote 1
                                    • lalalandsynthL
                                      lalalandsynth
                                      last edited by

                                      Thanks , checking out some videos

                                      https://lalalandaudio.com/

                                      https://lalalandsynth.com/

                                      https://www.facebook.com/lalalandsynth

                                      https://www.facebook.com/lalalandsynth

                                      1 Reply Last reply Reply Quote 0
                                      • lalalandsynthL
                                        lalalandsynth
                                        last edited by

                                        @d-healey I watched that video again , did the tutorial but I guess I am still a bit confused.
                                        Is there really no way to store which panel should show in a preset ?

                                        My plugin has this configuration where the panels are small, medium, large and which one is shown needs to be saved in a preset .rvb.jpg

                                        https://lalalandaudio.com/

                                        https://lalalandsynth.com/

                                        https://www.facebook.com/lalalandsynth

                                        https://www.facebook.com/lalalandsynth

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

                                          @lalalandsynth You made another thread about this, I've responded there already :)

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

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

                                          19

                                          Online

                                          1.8k

                                          Users

                                          12.1k

                                          Topics

                                          105.8k

                                          Posts