HISE Logo Forum
    • Categories
    • Register
    • Login

    Look and Feel - Toggle Buttons and the MIDI Sources panel...

    Scheduled Pinned Locked Moved Bug Reports
    62 Posts 7 Posters 4.0k 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

      LAFF.png
      Works perfectly in DAW

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

        So in order to use the settings tile I have to make all combo boxes transparent and then redraw the settings tile using a panel and a paint routine?

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

          @d-healey Not only transparent, you can select any Combobox/Custom settings panel color from the code.

          laf.registerFunction("drawComboBox", function(g, obj) {
           .........rest of the code
              g.setColour(0xFFC7D1D6);
          });
          
          
          const var laf = Engine.createGlobalScriptLookAndFeel();
          

          Always override the default LAF. So you don't need to write Paint routine to draw combobox. The default combo box will be overridden by the drawComboBox

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

            Content.makeFrontInterface(500, 400);
            
            const var laf = Engine.createGlobalScriptLookAndFeel();
            laf.registerFunction("drawPopupMenuBackground", function(g, obj)
            {
                g.fillAll(0xFF222222);
            
            });
            
            laf.registerFunction("drawPopupMenuItem", function(g, obj)
            {
                var a = obj.area;
                var h = a[3];
                
                if(obj.isSeparator)
                {
                    g.setColour(Colours.white);
                    g.drawLine(a[0]+10, a[0] + a[2]-10, a[1] + a[3]/2, a[1] + a[3]/2, 1.0);
                    return;
                }
                
                if(obj.isTicked)
                {
                    g.setColour(0x9F5AC4EC);
                    g.fillEllipse([a[0] + h/3, a[1] + h/3, h/3, h/3]);
                }
                
                g.setFont("Calibri", 15.0);
                
                if(obj.isHighlighted)
                {
                    g.setColour(0x9F5AC4EC);
                    g.fillRect(obj.area);
                    g.setColour(Colours.white);
                    g.drawAlignedText(obj.text, [a[0] + h, a[1], a[2] - h, a[3]], "left");
                }else{
                    g.setColour(Colours.white);
                    g.drawAlignedText(obj.text, [a[0] + h, a[1], a[2] - h, a[3]], "left");
                }
            });
            
            laf.registerFunction("drawComboBox", function(g, obj) {
                var a = obj.area;
                g.setColour(0xFF1B2129);
                g.fillRoundedRectangle(a, 1.0);
                g.setColour(Colours.withAlpha(0xFFACACAC, (obj.enabled && obj.active) ? 1.0 : 0.2));
                g.drawAlignedText(obj.text, [a[0] + 10, a[1], a[2] - 30, a[3]], "centred");
                var h = a[3];
                g.drawTriangle([a[0] + a[2] - h/3 - 10, a[1] + h/3, h/4, h/4], Math.PI*2,1.0);
            });
            
            d.healeyD 1 Reply Last reply Reply Quote 2
            • d.healeyD
              d.healey @A Former User
              last edited by d.healey

              @Rudra-Ghosh Thanks for the example, that makes it more clear. I think I'm still going to avoid LAF for now, it feels too janky.

              ustkU LindonL 2 Replies Last reply Reply Quote 0
              • ustkU
                ustk @d.healey
                last edited by

                @d-healey The only thing I'm not confident is the Content.createPath() issue that makes the components disappearing as we mentioned in the related thread. I'm pretty confident about the rest. It is just that switching from custom to standard LAF makes some weirdness inside Hise (hence the reset function), but once compiled, everything works as it should.

                Can't help pressing F5 in the forum...

                d.healeyD ulrikU 2 Replies Last reply Reply Quote 1
                • LindonL
                  Lindon @d.healey
                  last edited by

                  @d-healey said in Look and Feel - Toggle Buttons and the MIDI Sources panel...:

                  @Rudra-Ghosh Thanks for the example, that makes it more clear. I think I'm still going to avoid LAF for now, it feels too janky.

                  exactly what I decided......

                  HISE Development for hire.
                  www.channelrobot.com

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

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • ulrikU
                      ulrik @ustk
                      last edited by

                      @ustk I had to put

                      Content.createPath()
                      

                      outside the function to get LAF to work with sliders, then it's working fine also when compiled

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

                      ustkU 1 Reply Last reply Reply Quote 0
                      • ustkU
                        ustk @ulrik
                        last edited by

                        @ulrik yeah that might do it, but since Christoph said it was bad to refer to external variables in a custom LAF, I’m a bit confused on doing this...

                        Can't help pressing F5 in the forum...

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

                          @ustk said in Look and Feel - Toggle Buttons and the MIDI Sources panel...:

                          @ulrik yeah that might do it, but since Christoph said it was bad to refer to external variables in a custom LAF, I’m a bit confused on doing this...

                          I'm a bit confused by it too. Christoph said

                          the methods that you give the LAF object must never access script variables outside their scope

                          But does that mean passing variables in as parameters or referring to variables within the function? What about external constants, won't they be resolved at compile time?

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

                            Right, I've spent most of the day playing around with LAF. It's usable, but it takes some getting used to and it still feels janky.

                            1 Reply Last reply Reply Quote 0
                            • ustkU
                              ustk @d.healey
                              last edited by

                              But does that mean passing variables in as parameters or referring to variables within the function? What about external constants, won't they be resolved at compile time?

                              That was a question I asked Christoph but I can’t find the thread... my question was about colours, for instance, is it safe when you use your own external colour var inside a LAF

                              Can't help pressing F5 in the forum...

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

                                @Christoph-Hart Any idea why paths are causing LAF controls to vanish?

                                1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart
                                  last edited by

                                  Do you have a reproducible example?

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

                                    @Christoph-Hart I will in a minute little while, dinner's ready :D

                                    1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey @Christoph Hart
                                      last edited by d.healey

                                      @Christoph-Hart said in Look and Feel - Toggle Buttons and the MIDI Sources panel...:

                                      Do you have a reproducible example?

                                      Actually @ustk has already provided an example - https://forum.hise.audio/topic/3732/custom-look-and-feel-component-id/12

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

                                        @ustk said in Look and Feel - Toggle Buttons and the MIDI Sources panel...:

                                        @Lindon It's not yet merged, but if you can't wait, just remove or comment out this line:

                                        Untitled.png

                                        Have you made a pull request?

                                        ustkU 1 Reply Last reply Reply Quote 0
                                        • ustkU
                                          ustk @d.healey
                                          last edited by

                                          @d-healey hum… dunno… I'll try to get my head around this tomorrow but pretty busy atm

                                          Can't help pressing F5 in the forum...

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

                                            @ustk If it's just the one line I can do it on my fork and make a pull request, I just wanted to check first that you hadn't already made a pull request for it.

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

                                            23

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.7k

                                            Posts