HISE Logo Forum
    • Categories
    • Register
    • Login

    Button.setValue(1) oninit not reflected in UI

    Scheduled Pinned Locked Moved General Questions
    14 Posts 5 Posters 254 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.
    • CyberGenC
      CyberGen @ulrik
      last edited by

      @ulrik I'm currently setting the value in oninit. I'd like the button to start in the on position. I had tried the .changed() as well as setting the default value property to 1, but neither of those did the trick.

      ulrikU 1 Reply Last reply Reply Quote 0
      • ulrikU
        ulrik @CyberGen
        last edited by

        @CyberGen does it have "saveInPreset" enabled?
        In that case it will remember the value you set when you save the project

        Hise Develop branch
        MacOs 15.3.1, Xcode 16.2
        http://musikboden.se

        CyberGenC 1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff @CyberGen
          last edited by

          @CyberGen What about calling the change after a delay?

          Content.callAfterDelay(500, function(){
               Knob1.setValue(1);
               Knob1.changed();
          }, this);
          

          Dan Korneff - Producer / Mixer / Audio Nerd

          CyberGenC 1 Reply Last reply Reply Quote 1
          • CyberGenC
            CyberGen @Dan Korneff
            last edited by

            @Dan-Korneff & @ulrik So, enabling "Save in Preset" works, but I didn’t want to rely on that for this, primarily because patches can be edited and that could mess with the initial setup that I'm looking for.

            I wasn’t aware of the callAfterDelay() function. That did the trick—thank you for the tip!

            I have to say, though, it’s still a convoluted way to achieve this, especially considering how many buttons I’d need to set it up for. I’m still wondering why simply setting the default value doesn’t work with script buttons. It seems to work fine with other components.

            1 Reply Last reply Reply Quote 0
            • CyberGenC
              CyberGen @ulrik
              last edited by

              @ulrik So I just realized, what you are saying here is that I should turn off the save in preset mode. That makes the setValue work. But not the default value.

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

                @CyberGen The default value of buttons seems to not be useful. If a control is set to saveInPreset then anything you set in on init will be overwritten immediately after by the stored value.

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

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

                  @d-healey I can confirm that the default value for buttons is not working here either.

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

                    @VirtualVirgin said in Button.setValue(1) oninit not reflected in UI:

                    is not working

                    What do you expect it to do?

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

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

                      @d-healey If I set the default value to "1" and recompile I would expect the button to be on.
                      Is that not what it is meant to do?

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

                        @VirtualVirgin said in Button.setValue(1) oninit not reflected in UI:

                        Is that not what it is meant to do?

                        It doesn't do that for any other control. With slider the default value is the value it will reset to when you double click it.

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

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

                          @d-healey Right, I see. What is it meant for then?

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

                            @d-healey said in Button.setValue(1) oninit not reflected in UI:

                            The default value of buttons seems to not be useful.

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

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

                            39

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            101.9k

                            Posts