Button.html

The Button BlackBox function creates an OS-native button that runs a script when clicked, just like a standard FileMaker button. The difference is that the button is rendered in the OS’s native style, so on the Mac you get a Mac OS button:

And on Windows you get a Windows style button:

 

No graphics or conditional formatting are needed to create buttons in these respective styles.

The other big advantage is that you can Disable or Hide the button by calculation: again, no conditional formatting is needed. When the button is disabled, it grays out properly, and cannot be clicked. Likewise, when it is hidden, it is truly hidden.

 

Button( "buttonText" ; "script" {; scriptParameter ; status ; bgColor })

Parameters:

 

Parameter Name

Description

1

buttonText

Text to display on the button

2

script

Script to be run on button-click if the button status is enabled. No script will run if the button is hidden or disabled.

3

scriptParameter
(opt)

Any parameters associated with the button.

4

status
(opt)

Text or name of a field containing “enabled” (the default), “disabled”, or “hidden”, or a calculation which returns one of those 3 values. e.g. If ( Home::In Action_EmailAddress = "" or PatternCount (Home::In Action_EmailAddress;"@") < 1 ; "disabled" ;"enabled")

5

bgColor
(opt)

Default is white, but you can specify the color: see “Background Color” in the “Basics” section.

Example:

Result:

The left screenshot shows the button when the status is enabled; the right one shows the button when the status is disabled.