HISE Logo Forum
    • Categories
    • Register
    • Login

    Type safety!

    Scheduled Pinned Locked Moved Scripting
    31 Posts 7 Posters 1.7k 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.
    • Adam_GA
      Adam_G @d.healey
      last edited by

      @d-healey doh! you were right. too many other programs open

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @Adam_G
        last edited by

        @Adam_G said in Type safety!:

        @d-healey doh! you were right. too many other programs open

        careful --- re-running the compile when th eissue is the one I pointed at can sometimes run successfully...

        HISE Development for hire.
        www.channelrobot.com

        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff
          last edited by

          I'm running into some undefined parameter warnings that I could use a hand with.
          I have a function that adds a childPanel to an existing panel. The paint routine is triggering Warning: undefined parameter 0 if the panel hasn't been created yet, or if the childPanel has been removed.

          	inline function addButton(panel)
          	{
          	    local button = panel.addChildPanel();
          	    button.set("allowCallbacks", "Clicks & Hover");
          	    
          	    button.setPaintRoutine(function(g)
          	    {
          	        g.setColour(this.data.hover ? Colours.red : Colours.blue);
          		g.fillPath(myPath, [10, 5, 14, 14]);
          
          	    });
          
          	}
          

          Is there a better way to do this that won't throw these warnings?

          Dan Korneff - Producer / Mixer / Audio Nerd

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

            @Dan-Korneff

            	inline function addButton(panel)
            	{
                        if (!isDefined(panel))
                            return;
            
            	    local button = panel.addChildPanel();
            	    button.set("allowCallbacks", "Clicks & Hover");
            	    
            	    button.setPaintRoutine(function(g)
            	    {
            	        g.setColour(this.data.hover ? Colours.red : Colours.blue);
            		g.fillPath(myPath, [10, 5, 14, 14]);
            
            	    });
            
            	}
            

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

            Dan KorneffD 1 Reply Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff @d.healey
              last edited by Dan Korneff

              @d-healey Perfect! Simple and effective.
              Actually, this method still returns errors

              Dan Korneff - Producer / Mixer / Audio Nerd

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

                @Dan-Korneff

                Actually, this method still returns errors

                Explain

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

                Dan KorneffD 1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff @d.healey
                  last edited by Dan Korneff

                  @d-healey I've added this to the childPanel functions:

                              if (!isDefined(panel))
                                  return;
                  
                  • Run the function that creates the child panel.
                  • Close the panel.
                  • Hit F5 to recompile All Scripts.

                  Then I get Warning: undefined parameter 0

                  After closer inspection, the warning is pointing to the line that contains fillPath. I can confirm that this path is being defined. It points to all paint routines

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff
                    last edited by Dan Korneff

                    Here's a basic example:

                    HiseSnippet 1334.3ocsW0uaaaCDWJIJs1acXEXO.b9OFjA7BrrcbhSPQasSxZ1VRLlSKJvPP.iDsMQjIMjnchQQd+1iydC1tizxRx4i1ZrI.KHd2u63cGu634tQReVbrLxxtv4yFyrr+VmdyDpgcFR4BqiOvx96bNgFqXQDCo1yFSiiYAV11q+KHA6BaXoe96W2lFRE9rTRVVePx8Y+NeDWkRs6a9MdX3Qz.147QYP23MG6KEcjgxIf8rtSUqwT+qoCXmRQXq4XYu4gAbkLpmhpXw.l1xfY8FJuQXv+AdL+pPFtvypGnHCYqNC4gAcS70XKK6M5l54qa77ev4Dd.eA8zHv2qYPRkHaLvdsmxj79JLI6LlzFFS5kN87i3iUobP64abNV.GH8oPnNqoXvZs1O+LmNR.gPs0H50rihfEKjvsY0pUHvqx6WrHDtiUjozHRWpfE5QdEIQRZPfllaICqRUHfbnTIHhYncMlEo3rXXS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CeXabsGvFgiq+Orw4Ci9BmC62m4qRMvMbN5iq5jmels2zievITUDGSTNcxndPCSeFr6BH8IFyYVCSYMqqljC0iIBzK9G3YNSObs8bldILsFQ8ijW5aJEwwcetlBXSB8z8Ef+lArl3YoKOyFmGASeeouedUcOAqspBVeUErwpJ31qpfMWUA2YUEb2Ouf3eN5sSTxQlxFKqS5dntels8gBJjApyVs9W.ObaiA
                    

                    Load it up and hit F5

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      @Dan-Korneff There's something really weird going on there because even if I delete everything in the script I still get the error when hitting F5.

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

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

                        Oh I found the solution (still not sure why it goes crazy even when the script was cleared though).

                        Child panels are kept between recompiles, so it's necessary to clear them all out before adding them. Just put this after you create the parent panel.

                        for (x in Panel1.getChildPanelList())
                        	x.removeFromParent();
                        

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

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

                        19

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        102.5k

                        Posts