HISE Logo Forum
    • Categories
    • Register
    • Login

    Help with iteration

    Scheduled Pinned Locked Moved Scripting
    13 Posts 5 Posters 321 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.
    • d.healeyD
      d.healey @VirtualVirgin
      last edited by d.healey

      @VirtualVirgin

      What's a dot box?

      The parameter you pass to getComponent needs to be the id of the component - I don't think your component is called "DotBox[i]".

      I'm assuming your components are going to be called something like "DotBox0", "DotBox1", etc.

      So you need to append i to the end of the name, like so

      Content.getComponent("DotBox" + i);

      You could also use Content.getAllComponents("DotBox\\d") which will create an array containing references to all components with "DotBox" in the name followed by a number.

      Also you can't declare a const in a loop, and you wouldn't want to here. Instead declare your array outside of the loop.

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

      VirtualVirginV 1 Reply Last reply Reply Quote 3
      • orangeO
        orange @VirtualVirgin
        last edited by orange

        @VirtualVirgin

        As the console warning message says, const var declarations must be on global level. So it can't be in a function or loop.

        Also push is a good way to create such arrays.

        const var arry_DotBox = [];
        
        for (i = 0; i < 16; i++)
        {
            arry_DotBox.push(Content.getComponent("DotBox" + i));
            arry_DotBox[i].setLocalLookAndFeel(dotBoxLaf);
        }
        
        

        develop Branch / XCode 13.1
        macOS Monterey / M1 Max

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

          @d-healey said in Help with iteration:

          @VirtualVirgin

          What's a dot box?

          A "DotBox" is just a modification of your checkbox.
          I prefer the dots for button matrices:

          Screenshot 2024-11-18 at 12.58.42 AM.png

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

            @VirtualVirgin for that use case it's better to use a panel rather than an array of buttons. Using a panel is also dynamic so you can change the number of dot boxes on the fly

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

            VirtualVirginV 4 Replies Last reply Reply Quote 0
            • ustkU
              ustk @VirtualVirgin
              last edited by

              @VirtualVirgin You might want to check this out

              Link Preview Image
              My tooth hurts...

              Yeah... My tooth hurts... I went to the dentist yesterday for an extraction... You might say, "well, why should I care about your tooth?" Nothing, you'd be r...

              favicon

              Forum (forum.hise.audio)

              But I don't guarantee the snippet will load because it's quite old...

              Can't help pressing F5 in the forum...

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

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • VirtualVirginV
                  VirtualVirgin @d.healey
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • VirtualVirginV
                    VirtualVirgin @d.healey
                    last edited by

                    @d-healey said in Help with iteration:

                    @VirtualVirgin for that use case it's better to use a panel rather than an array of buttons. Using a panel is also dynamic so you can change the number of dot boxes on the fly

                    In the example above the buttons are already on a panel.
                    Are you saying I should use a panel instead of buttons?
                    I can get multiple values from different places on a panel?

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

                      @VirtualVirgin said in Help with iteration:

                      Are you saying I should use a panel instead of buttons?

                      Yes. Take a look at this (1:45:44)

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

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

                        This post is deleted!
                        VirtualVirginV 1 Reply Last reply Reply Quote 0
                        • VirtualVirginV
                          VirtualVirgin @VirtualVirgin
                          last edited by

                          @VirtualVirgin Sorry about the multiples! I kept getting a "bad gateway error" when trying to post and it didn't look like they went through.

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

                            @VirtualVirgin just delete them then.

                            HISE Development for hire.
                            www.channelrobot.com

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

                            34

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            102.7k

                            Posts