HISE Logo Forum
    • Categories
    • Register
    • Login

    multi-column comboboxes -> HISE crashes constantly

    Scheduled Pinned Locked Moved General Questions
    16 Posts 3 Posters 343 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.
    • Oli UllmannO
      Oli Ullmann @d.healey
      last edited by

      @d-healey
      @Lindon

      Thank you both very much! :-)
      I will try out both suggestions.

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

        @Oli-Ullmann look at what you are getting back in the array sampleMaps after you've done the substitution, you are actually probably better off doing

        if(map.indexOf("Bass_") == 0)

        rather than

        if(map.contains("Bass_"))

        to make sure you are replacing one only occurrence

        Dave's approach is even better...

        HISE Development for hire.
        www.channelrobot.com

        Oli UllmannO 1 Reply Last reply Reply Quote 1
        • Oli UllmannO
          Oli Ullmann @Lindon
          last edited by

          @Lindon Thank you!

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

            @Oli-Ullmann this is interesting:

            const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three"];
            
            const cmbSamples = Content.getAllComponents("ComboBox");
            
            for (map in sampleMaps)
            {
            	reg firstSegment = map.substring(0, map.indexOf("_") + 1);
            	reg secondSegment = map.substring(map.indexOf("_") + 1, map.length);
            	Console.print(firstSegment.indexOf("_"));
            	firstSegment.replace("_", "::");
            	Console.print(firstSegment);
            	Console.print(secondSegment);
            }
            

            replace isnt working....for me at least..

            HISE Development for hire.
            www.channelrobot.com

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

              @Lindon Ok here you go.. the best of Dave and me ...

              
              const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"];
              
              const cmbSamples = Content.getAllComponents("ComboBox");
              
              for (map in sampleMaps)
              {
              	reg firstSegment = map.substring(0, map.indexOf("_") + 1);
              	reg secondSegment = map.substring(map.indexOf("_") + 1, map.length);
              	firstSegment = firstSegment.replace("_", "::");
              	map = firstSegment + secondSegment;
              }
              
              Console.print(trace(sampleMaps));
              
              populateComboBoxes();
              
              inline function populateComboBoxes()
              {
              	for(c in cmbSamples)
              	{
              		c.set("items", sampleMaps.join("\n"));
              	}	
              }
              

              HISE Development for hire.
              www.channelrobot.com

              Oli UllmannO d.healeyD 2 Replies Last reply Reply Quote 1
              • Oli UllmannO
                Oli Ullmann @Lindon
                last edited by

                @Lindon Thank you very much! I'll try that out right away! :-)

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

                  @Lindon Wrap it in a function to avoid wasting reg variables.

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

                  LindonL 1 Reply Last reply Reply Quote 1
                  • LindonL
                    Lindon @d.healey
                    last edited by

                    @d-healey yes yes ....I know...Im lazy.

                    HISE Development for hire.
                    www.channelrobot.com

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

                      @Lindon so here is it all wrapped in one function call

                      
                      
                      const var sampleMaps = ["Bass_ONE","Bass_Two","Bass_three","Gtr_One"];
                      
                      const cmbSamples = Content.getAllComponents("ComboBox");
                      
                      populateComboBoxes();
                      
                      inline function populateComboBoxes()
                      {
                      	
                      	for (map in sampleMaps)
                      	{
                      		local firstSegment = map.substring(0, map.indexOf("_") + 1);
                      		local secondSegment = map.substring(map.indexOf("_") + 1, map.length);
                      		firstSegment = firstSegment.replace("_", "::");
                      		map = firstSegment + secondSegment;
                      	}
                      	
                      
                      	for(c in cmbSamples)
                      	{
                      		c.set("items", sampleMaps.join("\n"));
                      	}	
                      }
                      
                      

                      HISE Development for hire.
                      www.channelrobot.com

                      Oli UllmannO 1 Reply Last reply Reply Quote 2
                      • Oli UllmannO
                        Oli Ullmann @Lindon
                        last edited by

                        @Lindon
                        @d-healey
                        Guys, it looks like it's working now. You are brilliant! :-) The solution was apparently to replace the text already in the sampleMap array.

                        Thanks a lot! If you're ever in Germany, I'll buy you a beer! :-D

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

                        22

                        Online

                        1.8k

                        Users

                        12.1k

                        Topics

                        105.0k

                        Posts