HISE Logo Forum
    • Categories
    • Register
    • Login

    Is there a way to set button text from script?

    Scheduled Pinned Locked Moved Scripting
    14 Posts 3 Posters 259 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 @Oli Ullmann
      last edited by

      So this is working to set text:

      //Loop to set C note numbers
      for (i = 0; i < fullKeyboard0.length; i++)
      	fullKeyboard0[i][0].set("text", "C" + i);
      

      But when I run a test to set the id of components:

      OneOctaveKeyboard0[0].set("id", "Test");
      

      I get:

      Interface:! Line 243, column 26: the property doesn't exist
      

      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't change a component's ID.

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

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

          @d-healey said in Is there a way to set button text from script?:

          @VirtualVirgin You can't change a component's ID.

          So there is no way to change the ids programmatically?
          I have a use case for changing the numbering after multiple components are created.

          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 IDs are fixed, once they can only be changed in the property editor. They can't be changed dynamically.

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

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

              @d-healey said in Is there a way to set button text from script?:

              @VirtualVirgin IDs are fixed, once they can only be changed in the property editor. They can't be changed dynamically.

              My issue is that the black keys must be on top (to get the click of the button), so the ordering in the Component List turns out like this:

              Screenshot 2024-11-28 at 6.51.39 PM.png

              When octaves are multiplied, and of course the whole keyboard as well, they stay in the right order for the buttons to work, but the auto-numbering will take them out of order for the "Key" names to match MIDI note numbers.

              I take it if I just ignore the "Key" numbering beyond the basic level, then I could reassign them all to indexes in an array that match the MIDI note numbers with some modulo math.

              I'd have to live with "Key1" being MIDI note # 2 though, etc...

              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 I'm not 100% sure what you're doing, but it sounds like you're adding components dynamically at run time (after on init), if that is the case I think you'll run into issues.

                If you want to change which components appear on top of one another you can use setZLevel().

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

                VirtualVirginV 2 Replies Last reply Reply Quote 0
                • VirtualVirginV
                  VirtualVirgin @d.healey
                  last edited by VirtualVirgin

                  @d-healey said in Is there a way to set button text from script?:

                  @VirtualVirgin I'm not 100% sure what you're doing, but it sounds like you're adding components dynamically at run time (after on init), if that is the case I think you'll run into issues.

                  If you want to change which components appear on top of one another you can use setZLevel().

                  Not trying to create them dynamically, just trying to make it easy to copy and paste in order to use multiple keyboard instances in the same interface when needed.

                  I think this "setZLevel()" will do the trick for the current problem :)
                  I can just put them back in numbered order and set the Z with a loop.

                  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 Is there a way to set button text from script?:

                    Not trying to create them dynamically, just trying to make it easy to copy and paste in order to use multiple keyboard instances in the same interface when needed.

                    If you can it would be good to share more details about what you're wanting to achieve, I'm sure there is a simpler way than using lots of buttons. If a single panel can't do it, then perhaps using child panels which can be created/removed dynamically.

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

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

                      @d-healey said in Is there a way to set button text from script?:

                      @VirtualVirgin said in Is there a way to set button text from script?:

                      Not trying to create them dynamically, just trying to make it easy to copy and paste in order to use multiple keyboard instances in the same interface when needed.

                      If you can it would be good to share more details about what you're wanting to achieve, I'm sure there is a simpler way than using lots of buttons. If a single panel can't do it, then perhaps using child panels which can be created/removed dynamically.

                      I'll just continue making it my way for the moment for the sake of completion, then I'll send the snippet for the keyboard.

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

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

                        @d-healey said in Is there a way to set button text from script?:

                        @VirtualVirgin I'm not 100% sure what you're doing, but it sounds like you're adding components dynamically at run time (after on init), if that is the case I think you'll run into issues.

                        If you want to change which components appear on top of one another you can use setZLevel().

                        The function for:

                        ScriptButton.setZLevel(String zLevel)
                        

                        Does not appear to be working.

                        Here is a test snippet:

                        HiseSnippet 903.3ocsV01aaaCDlxwpXV6ErBr8ch7ImhhVY4jlZLTzT6D2YrlDi4rhs9kBZpyQDQhTPjJoFECX+j2efg1iRJwJId4EuU+ACc7tGdO2oGdTiyTbPqUYDGuilmBDmuwcxboIZPDSHIi1k37it8yMFkj9N5afSgX5Qf1P5OOko0PHwwYsWaC0oUSRwu+9k8YwLIGVrDg7VkfCuQjHLKVc7N+hHNdHKDNRjTK5M2YDWIGnhU4HsVy0mjx3mvNFNfYCqgK4mY5Hhyib47M6AOeVv19A8fsB2bZPGeVfeudaCrs74S6ArfYS49DmGrWnvnxlXXFPiaZeU37IQpyjkI3sBsXZLXM5PlfYtbYxfHQb33y6QZBwo43Ecr0J6X+f69hPwEquny88ENnKPTuo4z3lnTm6AkbpQolkT5gtS3YhTyBOV970tijFHaFCe2TmJkwRZ7ONtCTXDRySRXm.CyPiKPz9Y99Olh+swO448zm1kNsPUn8v2UZC8TVFsTmzg9B54aywfYfJIUIQi1qW4ecbGtJnfaATvx.08V.0c8RtpACJdiKDuFEMCeHSCTUVHjQaqUztTglhJbSDPmpPnITlLj1470LpzR3a3UUCOA2y2Ubbn85uJ9L1b8gxiTo1DVk65QzG0uUb4kyxkbi.2Xk7.kANT1dCuO50x6O8nW00rYK0msjyTwwP1RcaOLkcS.aKySlBYOF6jw4vEAhhmKqHevcSQxKeCTKPkbjTXNLEprGphCsJM6yWW+RpdEhJ40pXH9joPG+cU53xdJQfaRqpwQcHEzu9PFx8.dv+M3cWB7eaztLCydfrphvpLExLBayzYW3TbDX4wyVt6B5SPUUQIWoZwF9cnn+vhT9G6LegwA6blHzfSEcc9.ZFAhiiLVqgkU18HIA0Rxew9Bkjt0qDwcOIWeVGNkUElGyLWdzq8RoJGn5+Ry6ryzjZgYd8Kst573l+6pe+Zp+aQaeGo6CcGKL7nky2FKgunJ6KMeqtc6ac2a1LfaVP1ltC+8a7pr+enxupxMB4w6yLYBTq3dPdxD7KB3.xDoDh0VMQCqtqz12Za6LS.YXgwmveUN6Xscpb14bmjDFOS8dd44d6coeUwJHmjEeqQK28s1zkLrIAuZ+8b9k2pqALXUA1cUAt4pBbqUE3yVUfaup.e9sCz9kWuJGuIu73Dgr+38JFO63rmjgpwBkK4yf.aA.J
                        

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

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

                        53

                        Online

                        1.7k

                        Users

                        11.8k

                        Topics

                        103.0k

                        Posts