Forum

    • Register
    • Login
    • Search
    • Categories

    setSliderAtIndex on/off

    General Questions
    2
    5
    62
    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.
    • MikeB
      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

      Lindon 1 Reply Last reply Reply Quote 0
      • Lindon
        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

        MikeB 1 Reply Last reply Reply Quote 0
        • MikeB
          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

          Lindon 1 Reply Last reply Reply Quote 0
          • Lindon
            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
            • MikeB
              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

              6
              Online

              1.1k
              Users

              7.0k
              Topics

              64.7k
              Posts