Hi, you can use 2 buttons "Show" and "Hide" on your layout that each set the value of a global variable to a value , say "1" for the show and "0" to hide the items.
Set a variable ($$Variable) to 0 with the on layout enter script step (your default hidden)
The show buttons own visibility is set to hide when $$Variable = 1
The hide buttons own viability is set to hide when $$Variable = 0
Place the buttons directly over each other.
Any fields or items you wish to hide, set their visibility to hide when $$Variable = 0
you may or may not need a refresh window script step on the button, I can't recall.
Thanks for the help Eoin,
I tried it, but I can't seem to get it to work. The hide buttons and fields with $$variable set to 0 works for the OnLayoutEnter trigger (when I enter the layout, the "Show" button is visible), but I can't toggle the $$variable value with the buttons. The "Hide" button stays hidden. What am I doing wrong? This is what I did:
I set a script trigger to run script OnLayoutEnter. The script is:
Set Variable [$$showhide ; value:0]
I then went to Button setup and set it to Set Variable [$$showhide ; value:1] for the show button, and Set Variable [$$showhide ; value:0] for the hide button. When that didn't work, I tried to set the buttons to run a script that set the variables instead, but that did not work either.
I set the hide object when calculation to $$showhide = 1 for the show button, and $$showhide = 0 for the hide button.
I'm pretty new to FileMaker, sorry to be a pain!
I still don't know what I did wrong, but I worked around it: if I use a global field instead of a variable it works as expected. Thanks!
It was the lack of a refresh window script step. I wasn't quite sure at the time I wrote the reply but checking now ... you need to refresh the window. you can check it by adding the script step in the script for each button or just use the menu RECORDS, REFRESH WINDOW to do a quick check. (shift+cmd+R on a Mac)
Like you, I'm new to filemaker, sorry about that.
Instead of Refresh Window, you might use Refresh Object as this allows you to update the appearance of a single object on your layout instead of the entire layout. You'll need to give your objects that appear/disappear an object name via the inspector's name box to pull that off, but it can result in less "layout flash" than refreshing the entire window.
Thank you, I got it working - appreciate the help!