Hiding objects could be more robust

Discussion created by scottworld on Apr 12, 2016
Latest reply on Jul 28, 2016 by dustyhanes

It's hard for us to figure out when the "Hide Object When" option evaluates whether to hide an object or not.


For example, we only want to show an object (that is sitting OUTSIDE of all tab panels) when a certain tab panel is brought to the front. The simplest way to do this would be to simply place the object inside that particular tab panel. Then, it will only appear when that tab panel is brought to the front. But we have been requested to place it outside of the tab panel, so we need to use some other trickery to make it work.


Method #1:

At first, we thought this would be very easy within FileMaker. Simply select the object in layout mode, and then use this criteria for "Hide Object When": GetLayoutObjectAttribute ( "MySpecialTab" ; "isFrontTabPanel" ) <> 1


However, that method doesn't doesn't get the "hide object when" function to re-evaluate upon switching tab panels. Interestingly enough, FileMaker's Data Viewer DOES refresh properly. But that information isn't communicated to the "hide object when" functionality.


Method #2:

It also doesn't work if we use that exact same formula above in an unstored calculation field, and then tell the "hide object when" calculation to evaluate the unstored calculation instead. That still doesn't work, even though FileMaker's "Data Viewer" always displays the appropriate value using this method as well!


So again, even though FileMaker's "Data Viewer" is ALWAYS refreshing with the proper values upon switching tabs (no matter which method we use above), FileMaker doesn't pass this refreshed information along to the object's "Hide Object When" calculation.


Method #3:

We actually have to force a "Refresh Window" script step order to get "hide object when" to re-evaluate, but there's not even a quick way to do that. At first, we thought that we could simply use a OnPanelSwitch script trigger to trigger a "Refresh Window" script step upon switching tabs. But OnPanelSwitch only evaluates BEFORE switching tabs, so the refresh of the window happens while still on the old tab instead of the new tab. So this isn't really a viable solution, either.


Method #4 (the winning solution):

This is the method that works. We are forced to go one level deeper and use OnPanelSwitch in conjunction with Get(TriggerTargetPanel) in order to evaluate which tab we're going to, then populate a global field with that value -- which the "Hide Object When" function will FINALLY evaluate properly.


So, we have figured out the solution to this dilemma, but it seems like a lot of hoops to jump through. Instead, it would be great if the "Hide Object When" option could be more robust by evaluating calculations as often as the Data Viewer evaluates calculations.