HISE Logo Forum
    • Categories
    • Register
    • Login

    How does the .keyPressCallback() work?

    Scheduled Pinned Locked Moved Scripting
    18 Posts 3 Posters 439 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.
    • VirtualVirginV
      VirtualVirgin @d.healey
      last edited by

      @d-healey Ok, I'm getting it! :)
      A couple further questions I have about it though:

      A) the format here

      Label1.setConsumedKeyPresses({keyCode: 27});
      

      The parameters in curly brackets, that is not a key : value pair I think but is it JSON?

      B) When I click on the label the console will print:

      Interface: Key Pressed: {
        "isFocusChange": true,
        "hasFocus": false
      

      and when I click off the label it will print:

      Interface: Key Pressed: {
        "isFocusChange": true,
        "hasFocus": true
      

      That "hasFocus" seems reversed. Is that a bug, or do I not understand the logic of it?

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

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

        @VirtualVirgin said in How does the .keyPressCallback() work?:

        The parameters in curly brackets, that is not a key : value pair I think but is it JSON?

        JSON is made up of key/value pairs, so yes it's a JSON object with a key value pair :)

        @VirtualVirgin said in How does the .keyPressCallback() work?:

        That "hasFocus" seems reversed. Is that a bug, or do I not understand the logic of it?

        Yeah seems inverted to me too - there are a few things in HISE like that.

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

        VirtualVirginV 1 Reply Last reply Reply Quote 1
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by VirtualVirgin

          @d-healey Trying to set multiples and not getting the syntax:

          label.setConsumedKeyPresses({keyCode: 27}, {keyCode: 13});
          

          I thought that would do it.

          This obviously works, but seems too redundant:

          label.setConsumedKeyPresses({keyCode: 13});				
          label.setConsumedKeyPresses({keyCode: 27});
          

          Actually, that doesn't do it either, as the 2nd one (27) overwrites the first one (13).

          You can listen to my orchestral mockups here:
          https://www.virtualvirgin.net/

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

            @VirtualVirgin You can only pass a single parameter to the function. To pass multiple values you place them in an array:
            Label1.setConsumedKeyPresses([{keyCode: 27}, {keyCode: 13}]);

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

            hisefiloH 1 Reply Last reply Reply Quote 1
            • hisefiloH
              hisefilo @d.healey
              last edited by

              @d-healey just got here with the same issue! I found the problem seems to be using a Label. Have you tried a panel? Mac works!

              const var panel = Content.addPanel("p", 0, 0);
              
              panel.setConsumedKeyPresses("all");
              
              panel.setKeyPressCallback(function(obj)
              {
              	Console.print(trace(obj));
              });
              
              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @hisefilo
                last edited by

                @hisefilo said in How does the .keyPressCallback() work?:

                just got here with the same issue

                What's the issue? Didn't we solve it?

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

                hisefiloH 1 Reply Last reply Reply Quote 0
                • hisefiloH
                  hisefilo @d.healey
                  last edited by

                  @d-healey sorry, many tabs opened. Wrong thread. The issue you described here:

                  Link Preview Image
                  Return the old Content.setKeyPressCallback functionality (that we had for a few days)

                  Just ran into this myself opening an old project. I have a label. When the user types into the label I want to perform an action based on the text that is ty...

                  favicon

                  Forum (forum.hise.audio)

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

                    @hisefilo We solved that one too (scroll up in this thread), I was misunderstanding the new behaviour.

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

                    hisefiloH 1 Reply Last reply Reply Quote 0
                    • hisefiloH
                      hisefilo @d.healey
                      last edited by

                      @d-healey 😵 This is what 14 hours of screen time does to me! Sorry.

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

                        @hisefilo said in How does the .keyPressCallback() work?:

                        This is what 14 hours of screen time does to me!

                        I know that feeling!

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

                        hisefiloH 1 Reply Last reply Reply Quote 1
                        • hisefiloH
                          hisefilo @d.healey
                          last edited by

                          @d-healey Well! had a good sleep! back to the arena.

                          Do you know how to catch the "note off" or key release from computer keyboard?
                          Im handling this way, but obviously got hanging notes due no note off.

                          HiseSnippet 1507.3ocyX0sbSaDEVJIho1TXJcX5zK2wSuvvjIwNwwNoLLjDmevj3DSbBAZufYizZqkHsqP6JCtElgmh9HzGhdaeg3Mn8rR1VqHNAiKvTcgGc9aOe6YO64bjaExsIBAOzvL+w8CHFleqU69LoacWLkYzXKCyaZ0DKjjPTBqM6GfEBhigo4r6pXXlaNi3m2+fMwdXlMIkkgwS3Tax9TepLkaq02i54sC1gbL0WS6Jq2vlypy83Q.dl0pjQ.19bbWxAXkZyXY7Prv0v7tVkVoJgTa4NNN3kW1oZ0pqs5ZUVqLtSoJ3yJWcsJKUo1RqVqig4011gJ4gskXIQ.K5lbm9sc4uhk3fmPEzy7HJhxFsAOmv1ntK0yo0vfivvvzpUZnZ1jP0ssZRcni3mFx9tXAnTKzCZlybUPp7m.jL0fzbIP5VVssCoAxTIJ7bcqFL3DrCFNazgRhtFyb2qYUmCZvjK3iOmrSHPLxhhUKUZdD7yctW974WbwVd39HGhvgfjDaOrCG8xWQBk8yCGdBIpGNDEfYDuGGyEcezv0tKQVm6GvY.QwBZ5THdoUFZyEQ9Dm8H8EiLuPxx+3S29nieFV3zYi1asyu8Z6d+xSq+j.NMp0gMNw67W31c+8dzC20mcVyC1rvBh.OJ3F0Zu3hevZ2BrRsxSj040P5BB0dfMbgZEBAYhn3Ef8XLan50wddmA40E6DwrkTNqHoGDPtS9eOOBdTHMlwVXIFvXBW0SApXGtcj.xyXcIE94D0VHC24S011EGhsg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UG8YTEGSnKonSprxbhI9G3YfvxJZyABKOT3WEe3isC4O2NYtQUt72DyA12r3+3lbVMUznxFwyRpeF6CUEetsc1k5BFtzzZ3xSqgUlVCWYZMr5zZXso0vU+3FpZZsQjj6mbk0vnYqsiG91zbaFFx3iucX7uMR0n2.
                          

                          Screenshot 2025-02-28 at 12.48.35.png

                          The desired behavior is already happening on the built-in HISEs keyboard. (once clicked, you can play with your computer keyboard and it's getting notes on and off)

                          Screenshot 2025-02-28 at 12.49.20.png

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

                            @hisefilo I don't think there is way to detect a key up.

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

                            hisefiloH 1 Reply Last reply Reply Quote 0
                            • hisefiloH
                              hisefilo @d.healey
                              last edited by

                              @d-healey got it! thanks

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

                              18

                              Online

                              1.8k

                              Users

                              12.0k

                              Topics

                              104.4k

                              Posts