HISE Logo Forum
    • Categories
    • Register
    • Login

    One Click Button Instead of Two Clicks

    Scheduled Pinned Locked Moved General Questions
    4 Posts 3 Posters 311 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.
    • K
      kameron
      last edited by

      I have created two buttons for my effects page.

      However right now the buttons need to be pressed twice in order to open / close the window.

      Thats because when you first click on a button it's considered 'on'. When its considered 'on' thats when the window opens up or closes. But when the user clicks again the button is considered 'off' and it dose nothing to the panel. So the user has to click again to get the button 'on' in order for the panel to close or open.

      How can I make it so that the user only needs to click these buttons once to open or close instead of twice

      ///////////////EFFECTS  WINDOW///////////
      
      const var EFFECTS_Container = Content.addPanel("EFFECTS_Container", 0, 35);
      
      Content.setPropertiesFromJSON("EFFECTS_Container", {
          "width": 800,
          "textColour": "268435455",
          "borderSize": 1,
          "visible": false,
          "borderRadius": 0,
      });
      
      
      ////EFFECTS OPENER BUTTON////
      
      const var EFFECTS_Opener = Content.getComponent("EFFECTS_Opener");
      
      inline function onEFFECTS_OpenerControl(component, value)
      {
          if (value)
              EFFECTS_Container.set("visible", true);
      
      };
      
      Content.getComponent("EFFECTS_Opener").setControlCallback(onEFFECTS_OpenerControl);
      
      //// EFFECTS BROWSER CLOSE BUTTON ///////
      
      Content.getComponent("EFFECTS_Closer").setControlCallback(onEFFECTS_CloserControl);
      
      const var EFFECTS_Closer = Content.getComponent("EFFECTS_Closer");
      
      inline function onEFFECTS_CloserControl(component, value)
      {
          if (value)
              EFFECTS_Container.set("visible", false);
      };
      
      
      
      
      
      
      
      
      
      
      
      lalalandsynthL ustkU 2 Replies Last reply Reply Quote 0
      • lalalandsynthL
        lalalandsynth @kameron
        last edited by

        @kameron Make the button momentary

        https://lalalandaudio.com/

        https://lalalandsynth.com/

        https://www.facebook.com/lalalandsynth

        https://www.facebook.com/lalalandsynth

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

          @kameron Please share a snippet instead of a chunk of code

          Export -> Export as Hise Snippet

          This is probably due to buttons not being set to momentary

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

          K 1 Reply Last reply Reply Quote 0
          • K
            kameron @ustk
            last edited by

            @ustk ahh that's what I was doing wrong. I didn't set the buttons to isMomentary. That just fixed it. Thank you !

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

            13

            Online

            1.7k

            Users

            11.8k

            Topics

            102.4k

            Posts