HISE Logo Forum
    • Categories
    • Register
    • Login

    Vertical Slider - laf question

    Scheduled Pinned Locked Moved General Questions
    7 Posts 2 Posters 322 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.
    • ?
      A Former User
      last edited by

      I am having trouble making my vertical slider behave the way I want it to. I just started with this but the sliders are moving from top to bottom and not the other way round. So I'd need to invert that whole thing... How do I do that mathematically in a correctly scripted way in this case?

      Thanks for any advice!

      u

      const laf = Engine.createGlobalScriptLookAndFeel();
      
      laf.registerFunction("drawLinearSlider", function(g, obj)
      {
          var a = obj.area;
          if (obj.style == 3)
          {
        
              g.setColour(obj.bgColour);
              g.fillRoundedRectangle([a[0], a[1], a[2], a[3]*obj.value], 5);
             
          }     
      });
      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        Check out my video on custom sliders. Basically you have to subtract the value from the height.

        Here's an example

        var value = a[3] * obj.valueNormalized;
        
        g.setColour(obj.bgColour);
        g.fillRoundedRectangle([a[2], a[1], a[2], a[3]], 2);
        
        g.setColour(obj.itemColour1);
        g.fillRoundedRectangle([a[2], a[3] - value, a[2], a[3]], 2);
        

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

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @d.healey
          last edited by

          @d-healey I went back to that video but somehow couldn’t figure it out. I am having trouble understanding the whole syntax in laf world... I mean there’s the [x, y, w, h] but what is the a suddenly doing here?!

          ? 1 Reply Last reply Reply Quote 0
          • ?
            A Former User @A Former User
            last edited by

            @vewilya object area... I get it.... Maybe I'll take a quick break just now... 😬🤯

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @A Former User
              last edited by

              @vewilya Yeah using a just makes it easier to read because you don't have to keep writing obj.area[]

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

              ? 1 Reply Last reply Reply Quote 0
              • ?
                A Former User @d.healey
                last edited by

                @d-healey I see... And why are there 2 rounded rectangles in there?

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @A Former User
                  last edited by

                  @vewilya One for background one for the value, this is from one of my projects, you can just use the second rectangle if you don't need the background colouring.

                  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

                  17

                  Online

                  1.7k

                  Users

                  11.8k

                  Topics

                  102.6k

                  Posts