4 Replies Latest reply on Oct 2, 2014 7:47 PM by SkipGilleland

    Toggle Buttons

    SkipGilleland

      Title

      Toggle Buttons

      Post

      Is there an easy way to put two buttons on top of each other and hide the inactive button?  Basically I would like to press the "Hide Completed" Button, have it run the associated script then show the "Show all in Group" button in its place.  When that button is pressed...it would run the associated script and then show the "HIde completed" button again.  I would rather have one button that toggles versed 2 buttons side by side.

      Volleyball_Tryouts__DB00535_.png

        • 1. Re: Toggle Buttons
          philmodjunk

          Are you using Filemaker 13?

          If so, you can use the Hide Object When Setting to selectively hide and show buttons or any other layout objects on the layout.

          So your "Hide" expression for the "Hide Completed" button might be:

          Not $$HideCompletedVisible

          The script to show the button would use: Set Variable [$$HideCompetedVisible ; Value: True ]. The script to hide it would assign False to the variable. These set variable steps would then be included in the scripts that are performed when either of the two buttons are clicked.

          In older versions, there are other options that can hide and reveal layout objects, but if you are using an older version, it may be simpler to use a global variable or field to hold the button label text and just use one button for both tasks and have the button's script change the text of the label. (A conditional format expression can control the button's fill color).

          • 2. Re: Toggle Buttons
            SkipGilleland

            I am using Filemaker 13.  I don't understand "The script to hide it would assign False to the variable."  How does it know when to assign True or False?  Sorry, I am brand new to programming! :-)  I Really appreciate your help.

             

            • 3. Re: Toggle Buttons
              philmodjunk

              Clicking the visible button should hide it and reveal the hidden button, correct?

              So the Hide Completed button's script might have these two steps in it:

              Set Variable [$$HideCompletedVisible ; Value: False]
              Set Variable [$$ShowAllVisible ; Value: True]

              Your Show All button might have the same steps but with the values reversed:

              Set Variable [$$HideCompletedVisible ; Value: True]
              Set Variable [$$ShowAllVisible ; Value: False]

              Hmm and on further thought, since you'll have two buttons, on top of the other, you can actually just use this method to hide or show the top button, not both as long as the top button completely hides the bottom button from view when it is visible, so you could simplify this by only hiding/showing the top button and then you can use one less variable here and one less "hide object when" setting.

              • 4. Re: Toggle Buttons
                SkipGilleland

                Super it worked...thank you!  I am including screenshots for any other Noob!