Topics   All functions   Mac OS X   Windows   Crossplatform   Server   Components   Guides   Statistic  
New in version: 3.0   3.1   3.2   3.3   3.4   3.5   4.0   4.1   4.2   4.3   4.4  

Window.SetCloseButton

Component: Window
Version: 1.1
Mac OS X: Yes
Windows: Yes
Server: No

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

Parameters

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. 0
DatabaseFilename Optional. The name of the filename database where the script can be found. "test.fp7"
ScriptName Optional. The name of the script. "WindowClose"
Parameter Optional. Parameter for the script call. ""

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.

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

Feedback: Report problem or ask question.




Links
MBS Realbasic Chart Plugins - Pfarrgemeinde Messdiener Nickenich