HISE Logo Forum
    • Categories
    • Register
    • Login

    A couple of expansion questions

    Scheduled Pinned Locked Moved General Questions
    expansionspaint routinepreset browser
    80 Posts 4 Posters 1.6k 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.
    • R
      rzrsharpeprod @d.healey
      last edited by

      @d-healey said in A couple of expansion questions:

      What do you expect it to do?

      I thought that the image would react to the hover as it did before the image was loaded into it because of the line

      g.fillAll(Colours.withAlpha(Colours.darkgrey, this.data.hover ? 1.0 : 0.4));
      

      Actually I just realised that all I needed to put that line after the drawimage line in the repaint so that is solved.

      local props = e.getProperties();
      
      for (x in props)
          cp.data[x] = props[x];
      

      I thought you were just saying you used this in Rhapsody but didn't realise you were saying to add it to my project apologies.
      Ok so I have set the first line of text using this.data.Name and the 2nd line using the tags pulled in from the expansion data and it works and looks how I wanted it to.

      Ok so that's 2 things sorted, thankyou.

      On to the click event now so that it loads the expansion - well sets it I think is the term.
      Am I best to write a function that handles what happens when an expansion is set and then call that as part of the cp code? Or is there a better way to approach it?

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

        @rzrsharpeprod You can probably just do it all in the mouse callback because I think it's just a single function call if I remember correctly. If you need something more elaborate you can break it out into a separate function.

        The call is something like expansionHandler.setCurrentExpansion(expansionName)

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

        R 1 Reply Last reply Reply Quote 0
        • R
          rzrsharpeprod @d.healey
          last edited by

          @d-healey I put it directly in my click callback like this

          cp.setMouseCallback(function(event){
          		this.data.hover = event.hover;
          		Console.print("Hover");
          		
          		if (event.clicked)
          		Console.print("Clicked");
          		expHandler.setCurrentExpansion(expansionName);
          				
          		this.repaint();
          

          but got the error

           Can't reference local variables in nested function body
          

          So I created an inline function loadExpansion() and called it at the end of my code

          inline function loadExpansion()
          {
          expHandler.setCurrentExpansion(expansionName);
          }
          

          But then got this doing that

          API call with undefined parameter 0
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @rzrsharpeprod
            last edited by

            @rzrsharpeprod said in A couple of expansion questions:

              if (event.clicked)
              Console.print("Clicked");
              expHandler.setCurrentExpansion(expansionName);
            

            You need curly braces for your if statement {}

            Second, the error message is telling you what the problem is. expansionName is a variable you declared outside of the mouse callback, you can't use it in the mouse callback. You have to get the data you want from the child panel where you stored it.

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

            R 1 Reply Last reply Reply Quote 0
            • R
              rzrsharpeprod @d.healey
              last edited by

              @d-healey said in A couple of expansion questions:

              Second, the error message is telling you what the problem is. expansionName is a variable you declared outside of the mouse callback, you can't use it in the mouse callback. You have to get the data you want from the child panel where you stored it.

              Ah so I can use the this.data.Name again. That will sink in one day I promise.

              Did that and added the {} and it sets the current expansion when clicked now thankyou.

              I'll leave you alone now for a bit as I try and figure out eth best way to load the correct UI elements and trigger the controls repaint

              Thankyou again for all your advice and patience, it really is much appreciated

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

                @rzrsharpeprod Excellent, glad it's starting to come together :)

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

                R 1 Reply Last reply Reply Quote 1
                • R
                  rzrsharpeprod @d.healey
                  last edited by

                  @d-healey Now that this has all come together and is working nicely, the dropshadow question has reared it's ugly head.

                  How can I add a dropshadow - preferably an offset one - underneath each child panel?

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

                    @rzrsharpeprod Two methods. Draw it as part of the child panel, or do what I did with Rhapsody and draw it as part of the parent panel.

                    Link Preview Image
                    Rhapsody/Scripts/Grid.js at main

                    Rhapsody - HISE based sample library player.

                    favicon

                    Codeberg.org (codeberg.org)

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

                    R 1 Reply Last reply Reply Quote 0
                    • R
                      rzrsharpeprod @d.healey
                      last edited by

                      @d-healey I found one of your posts on here saying something similar but I can't get it to underneath with a bottom right offset like a true dropshadow would. It seems to draw from all sides at once and only on top and on the bottom portion of the tiles with the text not on the image. Presumably it is also drawing it on the bottom and right edges as well but you can't see it as it outside the bounds of the child panel

                      R 1 Reply Last reply Reply Quote 0
                      • R
                        rzrsharpeprod @rzrsharpeprod
                        last edited by

                        @rzrsharpeprod @d-healey I realised that the bottom section of the tiles were transparent so when I filled them and changed to drawing them in the grid under each one it worked

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

                        19

                        Online

                        1.9k

                        Users

                        12.5k

                        Topics

                        108.9k

                        Posts