HISE Logo Forum
    • Categories
    • Register
    • Login

    Button return opposite value for popup

    Scheduled Pinned Locked Moved General Questions
    buttonpopupopposite value
    4 Posts 3 Posters 361 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.
    • trillbillyT
      trillbilly
      last edited by trillbilly

      Hey Gang,

      I have a button controlling a popup. Right now, when the button turns on, the popup appears. Great. Now, how do I make this return the opposite (when button is on, popup is off)?

      Here is my current script for this

      const var DelayBlackoutimg = Content.getComponent("DelayBlackoutimg");
      
      inline function onDelayPowerbtnControl(component, value)
      {
      	DelayBlackoutimg.showControl(value);
      	Content.getComponent("DelayPowerbtn").setValue(value);
      };
      
      Content.getComponent("DelayPowerbtn").setControlCallback(onDelayPowerbtnControl);
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @trillbilly
        last edited by d.healey

        @trillbilly Use the invert/not operator !

        DelayBlackoutimg.showControl(!value);

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

        trillbillyT 1 Reply Last reply Reply Quote 1
        • trillbillyT
          trillbilly @d.healey
          last edited by trillbilly

          @d-healey Well I'll be a son of a gun...

          Thank you

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @trillbilly
            last edited by Lindon

            @trillbilly said in Button return opposite value for popup:

            @d-healey Well I'll be a son of a gun...

            Thank you

            or for those times where you are not using logical operators

            DelayBlackoutimg.showControl(1 - value);
            

            or you want the result to filp between 1 and minus 1:

            myVal = (value*2)-1;
            
            

            HISE Development for hire.
            www.channelrobot.com

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

            22

            Online

            1.8k

            Users

            12.0k

            Topics

            104.5k

            Posts