HISE Logo Forum
    • Categories
    • Register
    • Login

    Floating Tile Button

    Scheduled Pinned Locked Moved General Questions
    50 Posts 7 Posters 4.1k 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.
    • Tod SlaughterT
      Tod Slaughter @Christoph Hart
      last edited by

      @christoph-hart Can you please snippet the pop out preset browser like the one in hexeract?

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

        Fresh from the source:

        const var PresetDisplay = Content.getComponent("PresetDisplay");
        
        PresetDisplay.setPaintRoutine(function(g)
        {
        
        	g.fillAll(0xFF111111);	
        	
        	g.setColour(Colours.white);
        	
        	g.drawAlignedText(this.data.text, [0, 0, this.getWidth(), this.getHeight()], "centred");
        	
        });
        
        PresetDisplay.startTimer(200);
        
        PresetDisplay.setTimerCallback(function()
        {
            var text = Engine.getCurrentUserPresetName();
        	
            if(text == "")
        	text = "Init";
        	
            if(this.data.text != text)
            {
                this.data.text = text;
                this.repaint();
            }
        });
        
        const var presetBrowserData = 
        {
          "Type": "PresetBrowser",
          "Title": " ",
          "FontSize": 16,
          "ColourData":
          {
            "bgColour": "0xDD111111",
            "itemColour1": "0xFF46C0D8",
            "itemColour3": "0x3346C0D8"
          }
        };
        
        PresetDisplay.setPopupData(presetBrowserData, [PresetDisplay.getWidth()/2, 25, 800, 470]);
        
        NatanN 1 Reply Last reply Reply Quote 1
        • Tod SlaughterT
          Tod Slaughter
          last edited by

          yay! Thx ☺

          1 Reply Last reply Reply Quote 0
          • Tod SlaughterT
            Tod Slaughter
            last edited by

            @Christoph-Hart alt text

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

              @tod-slaughter I see no controls in your widget list and that function is part of the panel control class so you must have a panel on which to call that function. Basically the script Christoph gave you assumes there are some controls on your canvas, you'll need to create them manually.

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

              Tod SlaughterT 1 Reply Last reply Reply Quote 0
              • Tod SlaughterT
                Tod Slaughter @d.healey
                last edited by

                @d-healey

                I was just trying to test it to see how I could adapt it. Not sure what controls to add as this is called from a text "init" button on the interface of hexeract

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

                  @tod-slaughter Well I can see that the control PresetDisplay has the setPaintRoutine function attached. So I would guess you need to add a panel called PresetDisplay. In fact that is the only control I see mentioned in Christoph's script.

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

                  Tod SlaughterT 1 Reply Last reply Reply Quote 0
                  • Tod SlaughterT
                    Tod Slaughter @d.healey
                    last edited by

                    @d-healey Great I'll try that

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

                      Ah I forgot to enable mouse callbacks. Just add this line somewhere:

                      PresetDisplay.set("allowCallbacks", "Context Menu");
                      
                      Tod SlaughterT 1 Reply Last reply Reply Quote 0
                      • Tod SlaughterT
                        Tod Slaughter @Christoph Hart
                        last edited by

                        @christoph-hart said in Floating Tile Button:

                        PresetDisplay.set("allowCallbacks", "Context Menu");

                        SWEEEEEEET!!!!

                        1 Reply Last reply Reply Quote 0
                        • Tod SlaughterT
                          Tod Slaughter
                          last edited by

                          @d-healey david I've followed you basic tabs example but it's initialising with tab3 instead of tab1 .

                          Is there a way to focus oninit? const var page1 = Content.addPanel("page1", 4, 174);

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

                            @tod-slaughter If you set the saveInPreset property to true for the button you want to be enabled on init and all the others to false.

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

                            Tod SlaughterT 1 Reply Last reply Reply Quote 0
                            • Tod SlaughterT
                              Tod Slaughter @d.healey
                              last edited by

                              @d-healey the man with all the answers 😀

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

                                @d-healey said in Floating Tile Button:

                                If you set the saveInPreset property to true for the button you want to be enabled on init and all the others to false.

                                Hate to be picky, but that's not good advice. All controls related to UI handling (page swapping, making other elements visible, etc) must not have saveInPreset enabled, or the interface will do random things if you load user presets.

                                Instead, leave saveInPreset to false, and call setValue() for the given control directly in the onInit callback:

                                const var page1Button = Content.getComponent("page1Button");
                                const var page2Button = Content.getComponent("page2Button");
                                const var page3Button = Content.getComponent("page3Button");
                                
                                page1Button.setValue(1); // or whatever logic you need
                                page1Button.changed();
                                
                                Tod SlaughterT 1 Reply Last reply Reply Quote 1
                                • Tod SlaughterT
                                  Tod Slaughter
                                  last edited by

                                  The boss in the house. Thanks as ever @Christoph-Hart and @d-healey

                                  1 Reply Last reply Reply Quote 1
                                  • Tod SlaughterT
                                    Tod Slaughter @Christoph Hart
                                    last edited by

                                    @christoph-hart said in Floating Tile Button:

                                    page1Button.setValue(1); // or whatever logic you need
                                    page1Button.changed();

                                    How to set the page? This just sets the button.

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

                                      Not sure how you've setup your controls, but this should also fire the callback of the button which triggers the page swap.

                                      1 Reply Last reply Reply Quote 0
                                      • Tod SlaughterT
                                        Tod Slaughter
                                        last edited by Tod Slaughter

                                        @Christoph-Hart
                                        David's method works fine, your method sets the button but it doesn't cause the page to change. I'm not at the multiple preset stage yet so I can't comment on what awaits further down the line

                                        Actually that's not true it's working now albeit the button doesn't stay highlighted as being in the "on" state

                                        1 Reply Last reply Reply Quote 0
                                        • NatanN
                                          Natan @Christoph Hart
                                          last edited by Natan

                                          @Christoph-Hart
                                          Just For General
                                          What Is The Meaning Of The Numbers In This Line?

                                          PresetDisplay.setPopupData(presetBrowserData, [PresetDisplay.getWidth()/2, 25, 800, 470]);
                                          1 Reply Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart
                                            last edited by

                                            Just change them and see what happens...

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

                                            17

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            104.9k

                                            Posts