HISE Logo Forum
    • Categories
    • Register
    • Login

    Connect Slider Value

    Scheduled Pinned Locked Moved Newbie League
    10 Posts 4 Posters 176 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.
    • V
      voxuer1
      last edited by

      How can I link a slider's value to a label to display the value there?
      Thanks!

      d.healeyD ChazroxC 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @voxuer1
        last edited by

        @voxuer1 You need to do this through scripting. In your slider's control callback you can set the text property of the label.

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

        V 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @voxuer1
          last edited by

          Examples of how to access LAF (Look and feel) functions are in this video. If you know anything about scripting im sure you can figure it out how to push the value of the slider into the item that the text object will be looking for to display. Thats my version of code talk. lol. I have no idea how to script and learned how to do that from this video. Thats all.

          Here you go.

          V ChazroxC 2 Replies Last reply Reply Quote 0
          • V
            voxuer1 @Chazrox
            last edited by

            @Chazrox Thanx!

            ChazroxC 1 Reply Last reply Reply Quote 0
            • ChazroxC
              Chazrox @voxuer1
              last edited by

              @voxuer1 np. If you're new to HISE like I am, just watch all of @d-healey videos!

              1 Reply Last reply Reply Quote 0
              • ChazroxC
                Chazrox @Chazrox
                last edited by

                LAF (Look and feel) functions

                **Paint Routines

                1 Reply Last reply Reply Quote 0
                • V
                  voxuer1 @d.healey
                  last edited by

                  @d-healey After hours of watching YouTube tutorials, I've found a solution to link a label value to a slider, yeh, but there's just a small problem left that I can't fix. I want to round the value to 2 decimal places, which works, but sometimes I get values with more than 10 decimal places. Hmm, can you tell me what's wrong with my script?

                  const var Speed = Content.getComponent("Speed");
                  const var SpeedValue = Content.getComponent("SpeedValue");

                  inline function onSpeedControl(component, value)
                  {
                  local roundedValue = Math.floor(value * 100 + 0.5) / 100;
                  SpeedValue.set("text", roundedValue);
                  Console.print("Slider Value: " + roundedValue);
                  };

                  Content.getComponent("Speed").setControlCallback(onSpeedControl);

                  mmprodM 1 Reply Last reply Reply Quote 1
                  • mmprodM
                    mmprod @voxuer1
                    last edited by mmprod

                    @voxuer1 you could use the double to string function and specify how many digits you want

                    For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
                    John 3:16

                    V 1 Reply Last reply Reply Quote 0
                    • V
                      voxuer1 @mmprod
                      last edited by

                      @mmprod yes that´s it thanks

                      V 1 Reply Last reply Reply Quote 0
                      • V
                        voxuer1 @voxuer1
                        last edited by

                        @voxuer1 working code

                        const var Speed = Content.getComponent("Speed");
                        const var SpeedValue = Content.getComponent("SpeedValue");

                        inline function onSpeedControl(component, value)
                        {
                        local formattedValue = Engine.doubleToString(value, 2);
                        SpeedValue.set("text", formattedValue);
                        Console.print("Slider Value: " + formattedValue);
                        };

                        Content.getComponent("Speed").setControlCallback(onSpeedControl);

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

                        17

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.5k

                        Posts