Demo file: Show-Hide-Formatting-Bar.zip
Have you ever wanted to have a script toggle the Formatting Bar on/off in browse mode? If so, you will discover that FileMaker does not provide a “Show/Hide Formatting Bar” script step.
In FileMaker 12 and 13, the closest you will get to that script step is this one…
“Allow Formatting Bar” is a very odd script step, because “on” enables the ability to display the Formatting Bar, but (unless you know the trick, which we’ll get to shortly) does not actually display the bar itself.
Meanwhile “off” both disables the ability to display the Formatting Bar, and if the bar is currently visible, hides it as well.
There are two seemingly-identical demo files in today’s download:
- Formatting Bar – Non-working
- Formatting Bar – Works
…and as you might expect, the buttons work in the second second demo, but not in the first.
Incidentally, I could have attached the buttons to scripts, but in the interest of simplicity instead attached them directly to the “Allow Formatting Bar” action, like so:
Here are the steps to enable the buttons to show/hide the formatting bar:
- Make a copy of the “non-working” version of the demo — let’s call it simply “Formatting Bar”
- Open “Formatting Bar” — the file must be local, not hosted.
- In browse mode, click the “Formatting Bar: On” button
- While still in browse mode, choose “Formatting Bar” from the “View” menu, and at this point, the Formatting Bar should be visible.
- Go into layout mode.
- From the View menu, and choose “Formatting Bar” from the “View” menu. (Yes, you already did this in browse mode, but you need to also do it in layout mode.)
- Make some minor change to the layout, for example, select the buttons and move them up a point or two.
- Return to browse mode, and if the following dialog appears, click “Save”
- Now click the two buttons in browse mode, and observe that they show and hide the Formatting Bar… and henceforth the “Allow Formatting Bar” script step will behave the same way.
One potential problem with this technique: if, when the Formatting Bar is visible, your clever user disables it via the View menu, the buttons will stop working until the file has been closed and then re-opened, at which point the buttons will again function as desired.
To prevent the clever user from causing this mischief, use a custom menu set to remove the “Formatting Bar” entry from the View menu.