Hide and show object with button?
Is there anyway i can show and hide a portal based on a clicked button? Basically toggle 2 portals with click of button.
Yes. And it's much easier to do in FileMaker 13, but can also be done in older versions.
You can have your button perform a script that set's a global variable to a value and then uses refresh object to refresh the portal.
In layout mode, you'd give the portal both an object name and a Hide Object When expression that checks the value of the global variable to determine whether or not the portal is visible.
If you are using an older version, you won't have Hide Object When or Refresh Object as an option and you'd need to use other methods to make the portal appear/disappear.
I have 13, and will give this a go.
Figured out! Hide/Show
Hide Object when gPortal ≠ "1"
Set Field [Globals::gPortal ; If (gPortal ≠ "1" ; 1 ; 0)]
What you posted can be simplified to:
Set Field [Globals::gPortal ; gPortal ≠ 1 ]
Retrieving data ...