Forum
    • Categories
    • Register
    • Login

    Default button state on load

    Scheduled Pinned Locked Moved General Questions
    12 Posts 4 Posters 88 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.
    • dannytaurusD
      dannytaurus
      last edited by

      I have a toggle button that controls the visibility of a panel.

      Panel defaults to visible on load, and the button default value set to 1.0 in interface designer props.

      But when I load the project the button is in the 'off' state, which doesn't match the panel display state.

      Do I have to script the 'on' value in onInit, or is there a way to do it just in the interface designer?

      Content.getComponent("btnShowPanel").setValue(1.0);
      

      Meat Beats: https://meatbeats.com
      Klippr Video: https://klippr.video

      Oli UllmannO David HealeyD 2 Replies Last reply Reply Quote 0
      • Oli UllmannO
        Oli Ullmann @dannytaurus
        last edited by

        @dannytaurus
        That's how I always do it.

        dannytaurusD 1 Reply Last reply Reply Quote 1
        • dannytaurusD
          dannytaurus @Oli Ullmann
          last edited by

          @Oli-Ullmann Cools, cheers 👍

          Meat Beats: https://meatbeats.com
          Klippr Video: https://klippr.video

          1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @dannytaurus
            last edited by

            @dannytaurus said in Default button state on load:

            Do I have to script the 'on' value in onInit,

            Is the button set to saveInPreset?

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            dannytaurusD 1 Reply Last reply Reply Quote 0
            • dannytaurusD
              dannytaurus @David Healey
              last edited by dannytaurus

              @David-Healey No, it's for a show/hide tooltips panel.

              I suppose I should be saving the value somewhere so it survives across plugin loads.

              Are there any docs/examples for saving user preferences?

              EDIT: found an example: https://docs.hise.dev/tutorials/scripting/index.html#user-preference-system

              Meat Beats: https://meatbeats.com
              Klippr Video: https://klippr.video

              ustkU 1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @dannytaurus
                last edited by

                @dannytaurus You could also invert your logic so !value actually means the panel is showing

                Hise made me an F5 dude, browser just suffers...

                Oli UllmannO dannytaurusD 2 Replies Last reply Reply Quote 1
                • Oli UllmannO
                  Oli Ullmann @ustk
                  last edited by

                  @ustk
                  That's a cool idea!

                  1 Reply Last reply Reply Quote 0
                  • dannytaurusD
                    dannytaurus @ustk
                    last edited by

                    @ustk Could do, but I prefer to keep the button's 'on' state synced to the panel's visible state.

                    If I start flipping values as a workaround, my future self will not thank me when he looks at the code in 2 years! 😂

                    Meat Beats: https://meatbeats.com
                    Klippr Video: https://klippr.video

                    1 Reply Last reply Reply Quote 3
                    • David HealeyD
                      David Healey
                      last edited by

                      Another option is to have the panel and the button watch each other's states using broadcasters.

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      ustkU 1 Reply Last reply Reply Quote 1
                      • ustkU
                        ustk @David Healey
                        last edited by

                        dave.png

                        Hise made me an F5 dude, browser just suffers...

                        David HealeyD 1 Reply Last reply Reply Quote 2
                        • David HealeyD
                          David Healey @ustk
                          last edited by

                          @ustk

                          My current project :)

                          e821d434-e0d3-42b4-9449-1d4b75460505-image.png

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          ustkU 1 Reply Last reply Reply Quote 4
                          • ustkU
                            ustk @David Healey
                            last edited by

                            @David-Healey 😲 far worse than all I imagined 😁

                            Hise made me an F5 dude, browser just suffers...

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

                            24

                            Online

                            2.1k

                            Users

                            13.0k

                            Topics

                            113.2k

                            Posts