HISE Logo Forum
    • Categories
    • Register
    • Login

    LAF drawToggleButton

    Scheduled Pinned Locked Moved General Questions
    36 Posts 3 Posters 1.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.
    • NatanN
      Natan @d.healey
      last edited by

      @d-healey said in LAF drawToggleButton:

      var presetBrowserButtons = ["Add", "Rename", "Delete", "Save Preset", "More"];
      var newText = ["ADD", "RENAME", "DELETE", "SAVE PRESET", "MORE"];

      if (presetBrowserButtons.contains(obj.text))
      g.drawAlignedText(newText[presetBrowserButtons.indexOf(obj.text)], obj.area, "centred");

      Sir

      Could you please Post A Snippet, Where i suppose to use This?
      This Does Nothing!!!

      Content.makeFrontInterface(600, 500);
      
      /////  LAF   //////
      const var laf = Engine.createGlobalScriptLookAndFeel();
      
      
      laf.registerFunction("drawToggleButton", function(g, obj)
      {
      var presetBrowserButtons = ["Add", "Rename", "Delete", "Save Preset", "More"];
      var newText = ["ADD", "RENAME", "DELETE", "SAVE PRESET", "MORE"];
      
      if (presetBrowserButtons.contains(obj.text))
          g.drawAlignedText(newText[presetBrowserButtons.indexOf(obj.text)], obj.area, "centred");
          
      });
      
      DanHD d.healeyD 2 Replies Last reply Reply Quote 0
      • DanHD
        DanH @Natan
        last edited by DanH

        @Natan I don't think this is meant to work on the Preset Browser - the function is for the default HISE button. It was just an exaple for my benefit

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

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

          @Natan Looks like you're already using it correctly.

          @DanH Don't use an else, use an if. What you are saying with that else is if it's not in Button2Array, well that means anything in Button1Array or Button3Array.

          Also your ternary statement is pointless

          g.setColour(Colours.withAlpha(0xFFE3E3E3, obj.value ? 1.0 : 1.0));

          You're saying if obj.value is 1 then use 1.0 and if it isn't 1 use 1.0 as well :p

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

          NatanN DanHD 2 Replies Last reply Reply Quote 0
          • NatanN
            Natan @d.healey
            last edited by

            @d-healey BUt it does nothing Here?!!!
            Wont Change Anything :/

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

              @Natan Oh yeah you want drawDialogButton like I said in your thread ;)

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

              NatanN 1 Reply Last reply Reply Quote 1
              • NatanN
                Natan @d.healey
                last edited by

                @d-healey said in LAF drawToggleButton:

                drawDialogButton

                No Luck With Changes!!!

                HiseSnippet 1098.3ocsV00ahaDEcLINpPa5tqTk5qV7jQhEAI6tspQqZHASTTyGn.MsRQQqlXeAlF6YPiGmDZz9Wo+F6i8s160FhMaHq1fTgW7b+xm43y8NSOsxGhiUZlU4ASm.Lquwt+ToY79i4BI6vNLqu09XdrAzNYl1a5DdbLDvrrV6.xfU40Yo+96edOdHW5C4lXryUBe3HQjvjas2t+hHLrKO.FHhJD8a18PekbeUnJAwyZ1MYS39WyGAmvovJYyr1vKPXT59FtAhwX1SELs+X0sxr3OWDKtJDnEsX8wBkYls+XQXPu460XFyZ8d4670x14em8wh.wC1yYfWl5vIOihbfUoEgz5K.oVOEj5pBCnB7Dvyp.7VOCduxtuuVLwj6gv1WaenD+3LjizdQXkEKqzMkr2WgQHMMh3WCc03hGxv8cMaV24sMaVamMqP+Q5O13bCW6DxG57dGO4HgDZ3qAbycPn5JdXVgORottsLnK.gtySFSogFFIHwR2DouQnjtUCz7a6H3gpQ6kXLJoS05NCm6cTcG0U+QsMqbOU.mz27DMDCl8zpaiAcVNwHTtnZ6f.L2pmARTNPO0ABAS5S842.32GJQZ4wJMT8xclWQIb6.3NSVQ5zIsHdmz9Xuzh3cj2fzm529bOmdm402aPZQN8LuzhPkQLzwcY.qAxXFTmD6h6iFF7sTqFEuiynFzNucnXjDBnWu6LXbwRqiPF.2c5v7xbYJ0zfiTOBFe7CnFBpVaGGGBQeLizmSjNJ4IJCbpzsVk6qTtxGq37otFNbo9HwgVEFB5k5lZP0etDckIQWA55HQGl.ODHpZWrsXiur1B+LsZg.UxCkByoSfYqyabZsjFG1LwN9zudXGtgS8RyrgwMAzFAAGqNvM3forNqx1cf3qMpIowFMQIoJXsoY1XgLIe2PE2HjiFHPXKPD7B6hlZwtKeR162cZ9hC18VQfYLyx156KwXiAwnwFZ0eY8.dy.xKr6UTavtZz7ggk2v008enpILPTt0+E+sn0sJZNkAJ8ZK66IQYUhVoVkLQW0exwnSf5O3x6tIbYL94MtcLVrjHJjg7v3BwjR+5mn.jPK9wkEEByj4OxWW9MJMBdZv+BNOIIJCBTNamYKyvuQj4YHuqPOWj0r0rw1exu5OaGj8KwNKTggBPweV3fos1Mme2tH+xd7XZ7vBUPRH2r3IHzQkybfD7BipowwHsalV7nzmwwJMW5wJKs63KDtuxtmv3Od43szRvK1k8+MdmcH8l1dCGB9lbvttc2eeUOQ9Y.kyTITq9wbiVfc51n.sOJG7ADIRIDFSczknIPYqaRqIloOHCRWPhlYNaQqsl4r0bmrHtuV8A+rIqz0.9pTKHljo2.pLdULbsSKV5zVLO6lMZxhvam7AeehJdMh8kmyVqPNauB47lUHm2tB47tUHmeXEx4G+r4PWLrchQEk0lfF54kNz0xxSxQUVphj8efvMHRL
                
                NatanN 1 Reply Last reply Reply Quote 0
                • NatanN
                  Natan @Natan
                  last edited by

                  @Natan Yesss It Works

                  Content.makeFrontInterface(600, 500);
                  
                  
                  const var laf = Engine.createGlobalScriptLookAndFeel();
                  
                  
                  
                  laf.registerFunction("drawDialogButton", function(g, obj)
                  {
                      g.fillAll(0x22000000);
                      
                      if(obj.over)
                          g.fillAll(0x22000000);
                          
                      if(obj.down)
                          g.fillAll(0x22000000);
                         
                    var presetBrowserButtons = ["Add", "Rename", "Delete", "Save Preset", "More"];
                    var newText = ["ADD", "RENAME", "DELETE", "SAVE PRESET", "MORE"];
                  
                    if (presetBrowserButtons.contains(obj.text))
                      g.drawAlignedText(newText[presetBrowserButtons.indexOf(obj.text)], obj.area, "centred");  
                  
                  });
                  

                  Thanks You Sir :)

                  1 Reply Last reply Reply Quote 2
                  • DanHD
                    DanH @d.healey
                    last edited by

                    @d-healey I'll still need an else statement or the default buttons won't show in HISE...

                    How do I separate out the 'ifs' from the 'else' - if that's the right way of putting it.

                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                    https://dhplugins.com/ | https://dcbreaks.com/
                    London, UK

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

                      @DanH Use else if statements, and for the final one use just an else.

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

                      DanHD 2 Replies Last reply Reply Quote 0
                      • DanHD
                        DanH @d.healey
                        last edited by

                        @d-healey bam, thank you.

                        Basic JS stuff I should definitely know by now 🤦

                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                        https://dhplugins.com/ | https://dcbreaks.com/
                        London, UK

                        1 Reply Last reply Reply Quote 0
                        • DanHD
                          DanH @d.healey
                          last edited by DanH

                          @d-healey Is there a way to combine statements, so....

                          if (obj.value == 1 AND obj.over)

                          then do this...

                          Is it &&?

                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                          https://dhplugins.com/ | https://dcbreaks.com/
                          London, UK

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

                            @DanH Yes - that's called a logical operator if you want to look it up.
                            https://www.w3schools.com/js/js_comparisons.asp

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

                            DanHD 1 Reply Last reply Reply Quote 0
                            • DanHD
                              DanH @d.healey
                              last edited by

                              @d-healey was just on that page.... thanks.. learning all the time :)

                              Although deffo time to do a JS course

                              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                              https://dhplugins.com/ | https://dcbreaks.com/
                              London, UK

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

                              14

                              Online

                              1.7k

                              Users

                              11.9k

                              Topics

                              103.3k

                              Posts