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.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Tagged with →  

9 Responses to FileMaker 13 Hiding Objects

  1. David Moore says:

    Just made my life about a bazillion times easier!

  2. William OKeefe says:

    With a combination of sorting and hiding, place multiple copies of the same field on a list layout with your choice of horizontal spacing….makes an easy method for indented hierarchal lists!

  3. You mentioned sliding of object when another one disappears via condition, how do you get filemaker to do that in browse mode?

    • seedcode says:

      =) I said we spend a lot of time working around that… not that we have a solution for it. Best tools we have for this now are merge fields/variables and using web viewers as our display canvas instead of using layout objects. Neither are very satisfying currently. Some folks use portals to get around “reflow” and you could see virtual-list as a technique that gets at reflow, but it’s still a big open problem for us.

  4. Dion says:

    Hi there! Is there any way to hide objects when they are not on the active record in list view? For example, if I had a list of companies, and I wanted each company to have the buttons “Edit company”, “Add Invoice”, etc, only appear once that company is selected as the active record? I’m aware of the popover option, but some of the buttons I’m hoping to add are popovers (and you can’t have a popover within a popover). But it looks really cluttered if the buttons are always visible for each record in the list. Any help would be greatly appreciated! Thanks!

    • seedcode says:

      Hey Dion,

      In a portal you’d do something like this (where “Invoices” is the portal you’re interested in) to indicate if an object is on the active portal row or not: GetNthRecord ( Invoices::Invoice ID ; Get ( ActivePortalRowNumber ) ) = Invoices::Invoice ID

      There is no comparable calc/test for list view that I know of (VERY ready to be wrong about this), and even in portals the test above can be pretty heavy so you may want to script the arrival on the row / record and just write a var with the ID of the current record.

      Some ideas for doing this in a script can be found here: http://hbase.net/2010/07/24/highlighting-rows-in-filemaker-lists-or-portals/

  5. James says:

    I was trying to figure this out myself, and finally came up with this as one way to do it.

    For the list view layout I did this with, I set a script trigger in the layout setup to happen “On Record Load”.
    The script is –
    Set Variable [$$selectedrecord; Value:Get( RecordNumber )]
    Refresh Window ()

    Then the hide object when calulation is –
    Get ( RecordNumber ) ≠ $$selectedrecord

    Thats it. The part that took me awhile to figure out was that I needed the Refresh Window script step, until I saw this – The “hidden” condition of a layout object is evaluated when the record / layout is brought into view. If conditions change and a layout object should be hidden or displayed, the layout must be manually updated to reflect the new visibility state. This can be accomplished by using the (new)Refresh Object script step, or the Refresh Window script step. Alternately, switching from one layout back to the original layout will update the visibility state of affected layout objects.

    Hope that helps and would love to hear of any other ways there might be of doing this. Cheers!

  6. Tony says:

    I have a layout made up of rows. Sometimes a row has empty field(s) in it. Is there a way to hide the entire row, if it contains at least one empty field? Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Share →
DOWNLOAD
DayBack Calendar
DayBack's 30-day trial is unlocked so you can customize it and integrate it with your files.
Download DayBack and we'll send you a couple short emails with tips on how to modify it and use some of the coolest features.
Thank you! Please download: DayBack Calendar
Need More?
SeedCode tips & example files in your inbox
Need More?
SeedCode tips & example files in your inbox
Want More?
Be the first to see articles and tips like these
DOWNLOAD
TimeZync
Download TimeZync and we'll send you a couple short emails with tips syncing your FileMaker Go files.
Thank you! Please download: TimeZync
Want More?
Be the first to see articles and tips like these