Hiding FileMaker Objects: The Old Way
Before FileMaker 13 there was no native way to make an object conditionally visible. And sometimes it seems like we developers spent an inordinate amount of our time working around issues of “reflow” and “visibility”: getting objects to slide into the position vacated by now absent objects, and getting objects to show and hide correctly in the first place. Think of button states, error messages, and admin-only areas of our solutions.
There were three main techniques for conditionally hiding (or showing) an object before FileMaker 13:
Invisible portals. Objects would be placed inside a one-row portal that would only show records when a condition was true. Filtered portals let us do this without so many relationships on the graph but the fact that the portals were “invisible” made the technique hard to work with.
Hidden tabs. Something similar could be done with tabs and we’d then use a script to bring the once-hidden tab panel into focus when we wanted to see an object. This seemed to replace invisible portals for most developers and got a lot easier in FM12.
Conditional formatting. While the two techniques above added objects to the layout, in many cases you could hide an object using conditional formatting: setting the object’s fill to “blank”, or in the case of text, setting the font size to 300pt or 500pt when you wanted to hide the object. We used this frequently at SeedCode to hide developer-facing notes on a layout and to conditionally show and hide buttons.
While conditional formatting was in many ways the lightest of these techniques, it often doesn’t look good when a FileMaker 12 solution is opened in FM13. FileMaker 13 treats fonts a bit differently and you may find your previously hidden text objects “peeking through” in FM13.
FileMaker 13’s Hidden Objects
FileMaker 13 introduces an explicit “Hide object when” attribute on the data tab of the inspector. This means we now have a native way to hide an object.
However, the object is only “hidden” from your users, it isn’t gone, and sometimes it’s best to think if it as hidden from your users, but not from your scripts. Here are a few examples. A FileMaker 13 hidden object…
- …can’t be tabbed to by a user,
- But will respond to Go To Object without error and will then be the focus of Get ( ActiveLayoutObjectName ).
- It will work in QuickFind, even if “hide…” is enabled in Find Mode.
- It’s contents are available to the “Copy all records” script step.
Thus, while users can’t see the object, your scripts can. And that’s actually pretty cool.
Opening your FileMaker 12 Solutions in 13
So if you have a FileMaker 12 solution using conditional formatting to hide text, how do you make that look nice in FM13?
For most objects, just increase the font size used in the conditional formatting from 300pt to 500pt. That will re-hide the object so it no longer peeks through.
If you can hide the whole object, not just it’s text, use the new FM13 “hide object when”: simply copy the object’s conditional formatting calc–making sure it’s used for visibility, that is, making sure it set the text to some absurdly large font size–and use that as the object’s “hide object when” calc. Then delete that line of conditional formatting from the object.
Everything Old is New Again
Interestingly, there are still a few cases where we find the 500pt font trick to still be useful in FileMaker 13. For example, if you’d like to hide the text of a button until a user hovers over it (using the button text like a tool tip), you can set the buttons default font size to 500pt and set only it’s hover font size to something visible like 12pt.
We hope that helps.