Important: Not all BlackBoxes support overrides.
All Advanced BlackBoxes bundled with Reactor support this method of adding overrides: if you can see the Override Manager icon with BlackBox Debugging enabled, you can use the override helper to apply overrides.
You can use the Override Manager to discover what overrides are available for your BlackBox, and to generate the code to paste into the Override Helper function.
The Override Helper function:
| Parameter Name | Description | |
|---|---|---|
| 1 | functionName | The name of the BlackBox function you want to add an override for |
| 2 | type | The type of override you want to apply. - 'css' for a css override, which will change the display: colours, fonts etc. - 'js' for a JavaScript override, which will alter functionality of the BlackBox function. |
| 3 | override | The actual override value. See each BlackBox's documentation, or override manager for documentation of available styles and overrides. |
The function just feeds the override file to Reactor with the correct file/path name, and adds the function part around a JS override, so a call would look something like this:
BlackBoxOverride( "DayCal2" ; "js" ; "AllowEdits=false¶ActionOnApptEnter='Script=TheScript|GetField=TheTO::TheField'¶AllowScroll='vertical'" );
In that example we 'hard-coded' the overrides into the third parameter, but you could also use a FileMaker field reference:
BlackBoxOverride( "DayCal2" ; "js" ; Home::DayCal2Override );
That way, if you want to change or cancel the overrides on the fly, you can just modify the contents of that field.
Using the Override Manager to generate the code for your overrides is a great way to make sure everything is formatted correctly. To do this, just copy the calculated override from the Override Manager, and paste it into the 'override' parameter of your BlackBoxOverride function. Make sure to separate each override with the ¶ character.
Putting it all together, we recommend adding something like this into your web viewer calculation:
Let(
$$com.reactorize.log = $$com.reactorize.log & "¶" &
BlackBoxOverride( "DayCal2" ; "js" ; "/* Overrides go here */" ) & "¶" &
BlackBoxOverride( "DayCal2" ; "css" ; "/* Overrides go here */" ) ;
DayCal2(
/* Parameters to the DayCal2() BlackBox function go here */
)
)
That calculation includes both JS and CSS overrides, but you can use just one or the other. We are also putting the results of the calls to BlackBoxOverride() into a FileMaker global variable, so you can check that later in the Data Viewer to see if any errors occurred.
Sometimes you may want to use a BlackBox function that you have written in more than one place, i.e. on two or more different layouts in your database.
If you are applying overrides, please be aware that those overrides will 'stick around' after you first use them, and can apply themselves in the other places where you have used the same function.
This is beacause the overrides live in a page that is served up by Reactor which matches the name of your function. e.g. in the example above the JavaScript overrides live in a page called DayCal2.js, and any subsequent use of the DayCal2() function will see those overrides and make use of them.
The best way to avoid any nasty surprises from this is to make sure that you use an override each and every time when you use a function in multiple places. That way, every time the function loads it will have its own particular set of overrides load up with it at the same time. And they won't affect other uses of the function, because they will have loaded up with their own particular overrides when they started.
Often, all you will want to do is load up a completely empty set of overrides, so that the function knows to just operate with its own default settings. So the example above would look like this:
Let(
$$com.reactorize.log = $$com.reactorize.log & "¶" &BlackBoxOverride( "DayCal2" ; "js" ; "" ) & "¶" &BlackBoxOverride( "DayCal2" ; "css" ; "" ) ;
DayCal2(
...
)
)
That's all there is to it: that usage will make sure that on this occasion DayCal2() will load up with its default behaviour, and ignore any overrides you may have specified for it on other layouts.
Comments