This is one of my favorite tips, which we first published in August 2007 when conditional formatting was introduced in FileMaker Pro 9. A not-uncommon request we’ve received over the years is to highlight the current field with something more than slightly darker field borders. Conditional formatting seems the perfect answer: there must be a way to change a field’s background fill from its default to another color on entering the field, right?
Turns out… no. You cannot use conditional formatting to change a field’s fill color on entering it. It’s just not possible. Never. Conditional formatting does not work in any way whatsoever while focus is in the field in question. And that’s when the epiphany struck.
Instead of trying to change a field’s fill from the default to another color on gaining focus, make the default color of every field the color it should have on entry. Yes, that’s right, if you want fields to turn yellow when a user tabs to the field, make them ALL yellow in Layout mode. Now, use conditional formatting to change their color when they do not have focus. Select all your fields, and apply the following conditional formatting rule: set the fill color to white under the condition “Formula is…”
True
That’s it (and how’s that for a complicated calculation formula?). Now, whenever the field does not have focus, the conditional formatting is tested, the formula will evaluate as true (of course), and the unfocused field will have its “default” white fill. On entering the field, the conditional formatting disappears and the field turns yellow.
Log in or register to download the sample file.
Chad Novotny
05/11/2010
Thanks, Ed.
Conditional formatting uses a logical test, such as “salary < 50,000”, or “Self < Get ( CurrentDate )”, to decide when to apply the formatting. Each of these tests can result in either true or false. But True is always, well, true: the formatting is always applied. You could think of it as “1 = 1”; that’s always going to be true.
An even shorter way of writing “True” is the just the number “1”. In fact, if you have a formula that’s evaluates the word True (NOT in quotes, so as not to treat it as a string), you get the number 1. I just like to say True instead to be clear I’m talking about a logical value instead of a number; it’s the way my mind works.
Jim Liston
06/28/2010
Most excellent tip. Now, how about highlighting the whole record on focus. When in a list view, the only way to tell which record is being viewed is to look for thew black bar on the left of the layout. Not really intuitive. I saw a solution for this many years ago butI don’t remember where.
Chad Novotny
06/28/2010
Yeah, we should write that up as a tip too! Here’s the short version:
1. FileMaker 10 or 11
2. An OnRecordLoad trigger for your list view layout that sets a variable ($$recordID) to “Get(RecordID)”, and then refreshes the window
3. An empty text object filling the body part of your list view, with conditional formatting setting the fill to your chosen color when “$$recordID = Get(RecordID)”
And that’s it. Doing this without the OnRecordLoad trigger is a bit harder…
Marc Berning
11/06/2010
Another way to highlight the active field without involving conditional formatting:
1. Make the layout body Yellow (to use your colors).
2. Draw a solid box over the layout using the desired “normal” background color.
3. Place your fields on the layout.
A. Fields must be transparent.
B. In Layout Setup, disable “Show field frames when record is active”
voila!
P.S. Works in FileMaker Go too.
Log in as a member to comment...
Ed Roseman
05/10/2010
Very cool and ingenious. Thanks.
But I’m scratching my head trying to figure out what the “True” is “truing” about. WHAT is true? I’m sure this is a contracted paraphrase of some other command or logic, but what is it?