Note: A special thanks to Jason DeLooze for sharing this technique, which neatly remedies a small, but vexing, annoyance.
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.
Neat!
This doesn’t work when the file is hosted on a server.
If your platform is OS X, the following Applescript script set will work:
tell application “FileMaker Pro Advanced”
activate
tell application “System Events”
tell process “FileMaker Pro Advanced”
try
click menu item “Formatting Bar” of menu 1 of menu bar item “View” of menu bar 1
end try
end tell
end tell
end tell
FWIW: I had no problem with this working on a FMServer-hosted file.
Thanks Kevin & Jason. Nice solution.
-Joel
THANK YOU!!! I have been trying to figure this out (for a few weeks on the back burner).
Hello!
Thanks for taking the time to write this up. It is exactly what I have been looking for!
I have followed these instructions to implement this hack into my own solution, however I cannot get this to work after I close the window and/or the file. Essentially, it does not persist on my solution as it does with the sample files you have included here.
Is there something I might be doing wrong? Or perhaps this hack doesn’t work quite the same in FMPro Advanced 14? I followed the instructions provided enough times that you could call me insane (doing the same thing over and over, expecting different results) lol.
Thanks in advance for any help you may be able to provide.
this was great! thanks
After inheriting an existing host based solution for support/further-development, the customer wanted the Formatting Bar to be ON by default since she had to turn it on every time she used the file. When attempting to use this method while the file was hosted, it did not work. Moving the file locally, performing the method on the local file then worked for the local file, and then re-uploading the local version back to the server (replacing the non-working version) caused it to work for the hosted file too!
Yay!
Thanks, I was looking for a solution to this problem. Works perfectly.
I can’t get this to work. After the window is closed and re-opened, it stops working.
Hi Mike,
What OS and what version of FM?
Kevin
Just now I followed the instructions in the article, and it’s working fine for me (Win 7, FM 18). I closed and reopened the file twice to confirm.
not working on hosted solution in windows
any solution?
Two questions…
1. what happens if you host the “working” version of my demo file?
2. did you follow the instructions, including step 2?
> “Open “Formatting Bar” — the file must be local, not hosted.”
1 i will try tomorrow
2 what is step 2?
I use your file and works fine from local
i use my file and works fine from local
when i use the file on host from administrator account it works fine but if i open hosted file from user account it doesn’t work BUT if the users chose from menu bar, for one time the formatting bar voice after it work fine until the file is open. when the users close the file and reopen it from host, it doesn’t work again, the users it will chose another time the voice from menu for “activate” the function
Have noted that the problem is on FM Server 16 but all works fine on FM 18
Any suggestion?
Thank you so much for this! Solved a major issue for me :-)
Very nice, thanks.
For anyone having trouble getting this to work,
1. Make sure you do not have “Hide all toolbars” ticked in File Options.
2. Make sure the format bar is on and showing when you close the file locally before hosting it on your server. If it is off, it will not work when reopened. Of course, that means that the format bar will be visible by default when opening the hosted file, so you may want to close it with a script step in your opening script.
Once I worked out those issues and uploaded to my server it worked like a charm.
Thanks!!