Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3    Statistic  


Switches the close button on the window on or off.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Window 1.1 Yes Yes No No No

MBS( "Window.SetCloseButton"; WindowRef; State { ; AddMenu; DatabaseFilename; ScriptName; Parameter } )


Parameter Description Example value
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 Optional
Whether to add a close menu if needed. Default is false here.
DatabaseFilename Optional
The name of the filename database where the script can be found.
ScriptName Optional
The name of the script.
Parameter Optional
Parameter for the script call.


Returns OK on success.


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.


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

Window.SetBounds   -   Window.SetCurrentTag

Feedback: Report problem or ask question.

MBS Xojo Chart Plugins