HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF Function? || How do I LAF for Button "disabled" state??

    Scheduled Pinned Locked Moved Solved Scripting
    7 Posts 3 Posters 48 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.
    • ChazroxC
      Chazrox
      last edited by

      pretty much the title...

      Thank you if you can help! 🙏

      rglidesR 1 Reply Last reply Reply Quote 0
      • ChazroxC Chazrox marked this topic as a question
      • rglidesR
        rglides @Chazrox
        last edited by

        @Chazrox Try this

        const var Button1 = Content.getComponent("Button1");
        
        const var STATE_LAF = Content.createLocalLookAndFeel();
        STATE_LAF.registerFunction("drawToggleButton", function(g, obj)
        {
            g.setColour(0x00FFFFFF); 
            g.fillRect(obj.area);
                
            g.setFont("Ariel", 16); 
        
            if (!obj.enabled)
            {
                g.setColour(Colours.red);
                g.drawAlignedText("DISABLED", obj.area, "centred");
            }
            else if (obj.over) 
                { 
                    g.setColour(Colours.yellow);
                    g.drawAlignedText("HOVERED", obj.area, "centred");
                }
                else if (obj.value) 
                { 
                    g.setColour(Colours.green);
                    g.drawAlignedText("ONNNNNN", obj.area, "centred");
                }
                else 
                { 
                    g.setColour(Colours.grey);            
                    g.drawAlignedText("OFFFFFF", obj.area, "centred");
                }    
        });
        Content.getComponent("Button1").setLocalLookAndFeel(STATE_LAF);
        
        ChazroxC 1 Reply Last reply Reply Quote 1
        • ChazroxC
          Chazrox @rglides
          last edited by Chazrox

          @rglides said in LAF Function? || How do I LAF for Button "disabled" state??:

          if (!obj.enabled)
          {
              g.setColour(Colours.red);
              g.drawAlignedText("DISABLED", obj.area, "centred");
          }
          

          Boom that was it!
          Thank You!

          I was doing (obj.disabled) 🤕 lmao

          rglidesR d.healeyD 2 Replies Last reply Reply Quote 0
          • rglidesR
            rglides @Chazrox
            last edited by

            @Chazrox I tried that too before the ! attempt :D sometimes it's trial and error

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

              @rglides 💰

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

                @Chazrox Console.print(trace(obj))

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

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

                  @d-healey doh..forgot all about that one tbh.

                  1 Reply Last reply Reply Quote 0
                  • ChazroxC Chazrox has marked this topic as solved
                  • First post
                    Last post

                  12

                  Online

                  1.8k

                  Users

                  12.1k

                  Topics

                  104.9k

                  Posts