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 )   More

Parameters

Parameter Description Example
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

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.

Earlier plugins had a script trigger, but that was non functional for years since Claris moved to Windows Presentation Foundation for window handling.

Examples

Disable the Window Close button

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

Enable the Window Close button

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

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 22nd July 2025


Window.SetBounds - Window.SetCloseTrigger