HISE Logo Forum
    • Categories
    • Register
    • Login

    setSliderAtIndex on/off

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 165 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.
    • MikeBM
      MikeB
      last edited by

      This snippet is from Davids Video "Creating tabbed interfaces in HISE".
      There are 16 buttons here
      Each one is supposed to set a value in sliderpack3 to either 100 or 0.
      On 100 works
      On 0 not

      What is wrong?

      
      const var SliderPack3 = Content.getComponent("SliderPack3");
      const var Btn =[];
      
      for (i = 0; i < 16; i++)
      {
          Btn[i] = Content.getComponent("MyBtn"+(i+1));
          Btn[i].setControlCallback(changeLength);
      }
      
      inline function changeLength(component, value)
      {     
          if(value)
          {
          local idx = Btn.indexOf(component);
            
          for (i = 0; i < 16; i++);
              {       
             SliderPack3.setSliderAtIndex(idx,100);
              }
          
          }
          else{
              SliderPack3.setSliderAtIndex(idx,0);
          }     
      }
      

      "One hour of trial and error can save 10 minutes of reading the manual."
      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @MikeB
        last edited by

        @MikeB said in setSliderAtIndex on/off:

        inline function changeLength(component, value)
        {
        if(value)
        {
        local idx = Btn.indexOf(component);

        for (i = 0; i < 16; i++);
            {       
           SliderPack3.setSliderAtIndex(idx,100);
            }
        
        }
        else{
            SliderPack3.setSliderAtIndex(idx,0);
        }     
        

        }

        cant see what the loop is doing for you:

        inline function changeLength(component, value)
        {    
            local idx = Btn.indexOf(component); 
            if(value)
            {  
               SliderPack3.setSliderAtIndex(idx,100);
            }else{
                SliderPack3.setSliderAtIndex(idx,0);
            }     
        }
        

        HISE Development for hire.
        www.channelrobot.com

        MikeBM 1 Reply Last reply Reply Quote 0
        • MikeBM
          MikeB
          last edited by

          There are 16 buttons
          Each button sets :
          with value 1
          in Sliderpack3 the slider to 100
          with value 0
          in sliderpack3 the slider to 0

          button1 - slider 1
          button2 - slider 2
          button3 - slider 3
          and so on

          "One hour of trial and error can save 10 minutes of reading the manual."
          "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
          HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @MikeB
            last edited by

            @MikeB - yeah thats what the code I just posted does...

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • MikeBM
              MikeB @Lindon
              last edited by

              @Lindon said in setSliderAtIndex on/off:

              cant see what the loop is doing for you:

              i have only read this - sorry

              It works - thank you very much!

              "One hour of trial and error can save 10 minutes of reading the manual."
              "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
              HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

              57

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts