Forum Discussion

Jack_Viljoen's avatar
Jack_Viljoen
Brass Contributor
Feb 08, 2022

When a Button is clicked hide a Label

Hi all,

 

I am trying to make it so when a button is clicked, a label below it with some text in it hides, when I click it again it re-appears.

 

Any help is appreciated. Thanks

  • stum's avatar
    stum
    Copper Contributor

    Hi,

     

    • On your app, click on App and select OnStart and then create a variable as hideLabel and set it to true

     

    Set(hideLabel, true)

     

    • OnSelect function of your button create a variable and set it an if statement.

     

    If(hideLabel, false, true)

     

    And on your label's Visible function remove true and set it to hideLabel variable. So each time when you click on your button if hideLabel is true it will set it to false and hide your label, if it is false it will set it to true and display your label.

     

    Hope this helps. 

    Jack_Viljoen 

    • GenjiHatakata's avatar
      GenjiHatakata
      Copper Contributor

      stum , I think #2 should be like this:

       OnSelect -> Set(hideLabel, !hideLabel)

      to flip the hideLabel variable 

Resources