HISE Logo Forum
    • Categories
    • Register
    • Login

    Combobox load image

    Scheduled Pinned Locked Moved General Questions
    14 Posts 6 Posters 460 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.
    • MikeBM
      MikeB
      last edited by

      How to load a new image into an image module with each entry in a combo box?

      "One hour of trial and error can save 10 minutes of reading the manual."
      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

      Tania GhoshT 1 Reply Last reply Reply Quote 0
      • Tania GhoshT
        Tania Ghosh @MikeB
        last edited by Tania Ghosh

        @MikeB You can do it using Panel, Paint Routine and Switch-Case. Or You can do with only ScriptImage and Switch Case.

        Theme Image.gif

        Tania Ghosh

        1 Reply Last reply Reply Quote 0
        • MikeBM
          MikeB
          last edited by

          That's exactly what I meant - though I'm not a pro like you - do you have a snippet or a few lines of code to show me an approach?

          "One hour of trial and error can save 10 minutes of reading the manual."
          "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
          HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

          Tania GhoshT 1 Reply Last reply Reply Quote 0
          • Tania GhoshT
            Tania Ghosh @MikeB
            last edited by Tania Ghosh

            @MikeB
            All credit goes to my brother @Rudra-Ghosh . He always pushes me to learn & study HISE,JUCE etc.

            Content.makeFrontInterface(500, 400);
            
            const var ComboBox1 = Content.getComponent("ComboBox1");
            
            const var Image1 = Content.getComponent("Image1");
            const var Image2 = Content.getComponent("Image2");
            
            
            
            inline function onComboBox1Control(component, value)
            {
             
                
            switch (value)
            {
                case 1:
            Image2.showControl(false);
            Image1.showControl(true);
            
                case 2:
            
            
            Image2.showControl(true);
            Image1.showControl(false);
            
            };
            
            
            };
            
            Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
            

            Tania Ghosh

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • MikeBM
              MikeB
              last edited by

              Super many thanks -
              and it stays in your family :-)

              "One hour of trial and error can save 10 minutes of reading the manual."
              "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
              HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

              Tania GhoshT ustkU 2 Replies Last reply Reply Quote 1
              • Tania GhoshT
                Tania Ghosh @MikeB
                last edited by

                @MikeB My pleasure :)

                Tania Ghosh

                1 Reply Last reply Reply Quote 1
                • Christoph HartC
                  Christoph Hart @Tania Ghosh
                  last edited by

                  @Tania-Ghosh said in Combobox load image:

                  All credit goes to my brother @Rudra-Ghosh

                  The least he can do after he stole your account :)

                  ? 1 Reply Last reply Reply Quote 1
                  • ustkU
                    ustk @MikeB
                    last edited by

                    @MikeB No need for a switch here, 2 lines are enough:

                    
                    const var ComboBox1 = Content.getComponent("ComboBox1");
                    
                    const var images = [Content.getComponent("Image1"),
                                        Content.getComponent("Image2"),
                                        Content.getComponent("Image3")];
                                        
                                        
                    inline function onComboBox1Control(component, value)
                    {
                        // Hide all
                        for (img in images) img.showControl(false);
                        
                        // Show only the selected one
                        images[value-1].showControl(true);
                    };
                    Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
                    
                    

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

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

                      @ustk said in Combobox load image:

                      @MikeB No need for a switch here, 2 lines are enough:

                      Why use 2 when you can use 1 :p

                      inline function onComboBox1Control(component, value)
                      {    
                          for (i = 0; i < images.length; i++) images[i].showControl(i == value - 1);
                      };
                      

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

                      ustkU 1 Reply Last reply Reply Quote 4
                      • ustkU
                        ustk @d.healey
                        last edited by

                        @d-healey One of these days I'll be able to do it with a half-line and then you'll kneel before me 😝

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

                        1 Reply Last reply Reply Quote 1
                        • Tania GhoshT
                          Tania Ghosh
                          last edited by

                          Wow!!.. strange competitions are going on.. Who can write least amount of code.
                          Who won ultimately? ;) @d-healey or @ustk ?

                          Tania Ghosh

                          1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @Christoph Hart
                            last edited by A Former User

                            @Christoph-Hart
                            Please !! Don't say Stole
                            I think she always keeps disturbing you. Asking silly things on HISE forum. I think it is more important to study than always ask for help/post on Forum. So what is the point for HISE a/c. That's why I locked her A/c.
                            Do you think she is learning?

                            Tania GhoshT 1 Reply Last reply Reply Quote 0
                            • Tania GhoshT
                              Tania Ghosh @A Former User
                              last edited by Tania Ghosh

                              ..................................... :)

                              Tania Ghosh

                              1 Reply Last reply Reply Quote 0
                              • MikeBM
                                MikeB
                                last edited by

                                Thanks guys and lady,

                                4 - 2 - 1
                                I am also always amazed. How many possibilities there are and what is the shortest.

                                David inspires me again and again with his logically structured scripts - even if I don't always understand everything.
                                But I'm working on it :-)

                                "One hour of trial and error can save 10 minutes of reading the manual."
                                "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                                HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                                25

                                Online

                                1.8k

                                Users

                                12.0k

                                Topics

                                104.3k

                                Posts