Is there a formatting bar?
When you like to position something in a window in FileMaker Pro, you may wonder what toolbars are visible to the user. The user may have the normal toolbar and below and for some toolbars you an ask the state, but not for the formatting bar.
You can ask FileMaker with Get(AllowFormattingBarState) whether the formatting bar is allowed to show. And using the Allow Formatting Bar script step you can turn it on or off. But beside just turning it on or off to make sure you know the state, we could help with a function to know the state.
Our first try was to check the checkbox for the menu entry. While the plugin can check the checkbox state with Menubar.IsMenuCommandChecked, the problem is that FileMaker doesn't put the checkbox in the menu until you click on the menu. We checked that and the results was inconsistent as the result was always the setting from one try before.
The solution we got is the new Window.HasFormattingBar function. It will look in the window for what controls are there. If the plugin sees the controls for the toolbar, we report a 1. If we don't find them, we return a zero. There is also the chance to get -1 if the search can't be performed or the error message if the window identifier or name is wrong.
Let's put it in a script:
Set Variable [ $r ; Value: MBS("Window.HasFormattingBar"; 0) ]
If [ $r = 1 ]
# is visible
Else If [ $r = 0 ]
# is invisible
Else
# something wrong
End If
As you see you can compare to 0 or 1 to catch the result and also handle the case something went wrong. We pass 0 as window identifier for current window. But you can of course also just pass a window name or a window reference number as with other window functions.
Please try in 14.3 version of MBS Plugin.