Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Window.SetCloseButton

Switches the close button on the window on or off.

Component Version macOS Windows Linux Server iOS SDK
Window 1.1 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "Window.SetCloseButton"; WindowRef; State { ; AddMenu; DatabaseFilename; ScriptName; Parameter } )   More

Parameters

Parameter Description Example Flags
WindowRef Window Reference is the unique OS level window ID. You can obtain this by using the Window.FindByTitle or Window.FindByIndex functions. Pass zero to access the frontmost window. 0
State The new state of the close button. 1
AddMenu Whether to add a close menu if needed. Default is false here. 0 Optional
DatabaseFilename The name of the filename database where the script can be found. "test.fp7" Optional
ScriptName The name of the script. "WindowClose" Optional
Parameter Parameter for the script call. "" Optional

Result

Returns OK on success.

Description

Switches the close button on the window on or off.
Please note! On Windows that SetCloseButton removes all buttons from the title bar and not just the close button.

For runtime solution a special handling is needed. First on Mac you can simply use this function as normal to enable the close button and the window will close.
On Windows simply enabling will not work as the close button is linked to a close menu entry in the system menu for this window. So if AddMenu is true, the plugin will check the menu. If there is no close entry, it will install a default window menu. This way we can enable the close button. To actually close the window, we also install a callback to catch the clicks on this close button. We call your script so you can use the close window script step. This way we can have a close button on the runtimes.

Enjoy and use at your own risk. This function may not work with every FileMaker version, so please test carefully before you deliver. Tested with FileMaker 11.


With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.

Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.

Examples

Disable the Window Close button

MBS( "Window.SetCloseButton" ; 0; 0)

Enable the Window Close button

MBS( "Window.SetCloseButton" ; 0; 1)

Disable the Window Close button in a runtime on Windows:

MBS( "Window.SetCloseButton" ; MBS( "Window.FindByTitle" ; "window title" ); 1; 1; "mydatabase.usr"; "CloseWindow" )

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 27th January 2016


Window.SetBounds - Window.SetCloseTrigger