HISE Logo Forum
    • Categories
    • Register
    • Login

    How do we limit selectable samplemaps within a combobox?

    Scheduled Pinned Locked Moved General Questions
    13 Posts 3 Posters 562 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
      last edited by d.healey

      var element = document.getElementById('List')

      No no no no no no no. HISE Script is not Javascript. And there is no DOM. :D

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

      1 Reply Last reply Reply Quote 0
      • L
        LeeC
        last edited by

        ☺ Cheers @d-healey

        Just going through your 101 now.

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

          @LeeC said in How do we limit selectable samplemaps within a combobox?:

          for (i = 0; i < sampleMapList.length; i++){

          var newName = sampleMapList[i];
          if(sampleMapList.contains(BD_)){
              filteredSamplemaps.push(newName);
              
          }
          

          }

          er isnt the string checker

          string.includes("xyz")

          not

          string.contains("xyz")

          .. and dont you need to refer to the element not the whole array, so (guessing) something like:

          for (i = 0; i < sampleMapList.length; i++){
              
              var newName = sampleMapList[i];
              if(newName.includes("BD_")){
                  filteredSamplemaps.push(newName);
                  
              }
          }
          

          HISE Development for hire.
          www.channelrobot.com

          L 1 Reply Last reply Reply Quote 0
          • L
            LeeC @Lindon
            last edited by LeeC

            @Lindon said in How do we limit selectable samplemaps within a combobox?:

            for (i = 0; i < sampleMapList.length; i++){

            var newName = sampleMapList[i];
            if(newName.includes("BD_")){
                filteredSamplemaps.push(newName);
                
            }
            

            }

            Cheers for the response @Lindon...

            Just tried the string.includes("xyz") function but unfortunately it doesn't work in HISE.

            I might have to resort to just specifying an index range to pull back my desired samplemaps - if there isn't an obvious way to filter by name that is.

            Thanks again ☺

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

              @LeeC There is documentation built into the script editor

              bbb8c502-9474-4d10-969f-ca2b7c3b0f29-image.png

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

              L 1 Reply Last reply Reply Quote 0
              • L
                LeeC @d.healey
                last edited by LeeC

                @d-healey Yes this was my initial go to but there's nothing in this list directly related to filtering by name.

                Maybe going down the route of:

                string.substring(int startIndex, int endIndex) equals ("xyz")

                is the way forward?

                Apologies for not seeing anything that is obvious.
                Appreciate the 101 training either way.

                Cheers

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

                  @LeeC said in How do we limit selectable samplemaps within a combobox?:

                  is there a way to get a combobox to only pull back samplemaps 5-10

                  To go back to your original question, you wanted to filter by index 5-10, not name. So do you need to filter by name or by index?

                  To filter by name you can use indexOf, or you can use regex.
                  32c13e50-de86-40b9-8716-c213b3f384d8-image.png

                  If you right click on an item in the built in documentation it will give you more info about what the function does and how to use it.

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

                  L 1 Reply Last reply Reply Quote 1
                  • L
                    LeeC @d.healey
                    last edited by

                    @d-healey Yes you're right, my original question was asking to filter by index which your 101 has now taught me how to do.

                    However, ideally it would be greate to filter by name which would ultimately harness the power to pull back samplemaps from a list of hundreds (irrespective of their index number).

                    So to summarise, a way to filter by name would be ace.

                    Sorry for any confusion. ☺

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

                      Simplest way is to use indexOf

                      const var sampleMaps = ["sampleMap1", "sampleMap2", "sampleMap3", "sampleMap4", "sampleMap5"]
                      
                      Console.print(sampleMaps.indexOf("sampleMap2"));
                      

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

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

                        You can also use .contains even though that's not in the docs for strings @Christoph-Hart ?

                        Console.print(sampleMaps.contains("sampleMap2"));

                        This is helpful for a partial search, for example if you wanted to get all of the samplemaps with the word drum you could do .contains("drum") even if the name contains other words too.

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

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

                        45

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.9k

                        Posts