Here you'll find instructions for adding BackMagic to your own solutions.
Quick Start
1. Assign object names to each of your native FileMaker tabs.
2. Add the custom functions to your file(s). These depend on each other so it is simplest to create them in the following order:
SeedCode_GetValue
SeedCode_FrontTabName
SeedCode_BackMagic''LayoutState
SeedCode_BackMagic''Log
SeedCode_BackMagic
3. Add global container fields to hold the navigation images (the green and grey arrows). In our Demo these are four global container fields in the Interface table: IntArrowBackLitGlob, IntArrowBackDimGlob, IntArrowFWDLitGlob and IntArrowFWDDimGlob.
4. Create BackMagic's unstored calc in each of your tables, or in your interface table if using the separation model. Make sure this calc returns the type "container". After you've pasted zz.BackMagic.cr into your file, replace the names of our container fields with those you created (if different) from step 3 above. Once you've done this for one table, the field zz.BackMagic.cr can then be copied and pasted into your other tables without modification.
5. Copy and paste the script "Back FWD ( Direction )" into your file. This can be pasted without modification.
6. Paste the button controls onto each layout. The controls consist of 1 field (showing 5 horizontal repetitions), a couple text labels behind it, and a couple buttons on top of it: just drag select the whole thing. After you've pasted in on your layout you'll need to make sure that the field zz.BackMagic.cr is from the table occurrence on which the current layout is based or, if using the separation model, that it's from an occurrence of your interface table that is related to the table occurrence on which the current layout is based.
7. Paste an instance of the first repetition of zz.BackMagic.cr on to each of your native FileMaker tabs.
8. Enjoy!
Detailed instructions.
1. Assign object names to each of your native FileMaker tabs.
BackMagic (BM) uses the tab's object name to tell one tab from another. You'll want to name all the tabs on any layout in the back stack, including tabs which just enclose other tabs. Accidentally leaving a tab unnamed can cause BM to act like its not following you properly.
To name your tabs, enter layout mode and make sure "Object Info" is checked in FileMaker's "View" menu. Then select your tab- you know the tab is selected when it gets a thick black border around it-- and give it a name...
The name doesn't have to have anything to do with the tab's label, and FileMaker will insist that names be unique on the layout.
2. Add the custom functions to your file(s).
These depend on each other so it is simplest to create them in the following order:
SeedCode_GetValue
SeedCode_FrontTabName
SeedCode_BackMagic''LayoutState
SeedCode_BackMagic''Log
3. Add global container fields to hold the navigation images.
You'll need a few fields to hold the green and grey arrows used for the Back and fwd arrows in BM. Of course BM works without the arrow (using just the text "Back" and "FWD" for buttons) so you can skip this if you'd like.
You'll need to create four global container fields. If you don't already have a table for interface objects like this you can create a table called "Interface". If you use your own table, you'll need to make sure the field zz.BackMagic.cr, in step 6 below, uses that table name when it looks for these fields. So, in your Interface table create the global container fields IntArrowBackLitGlob, IntArrowBackDimGlob, IntArrowFWDLitGlob and IntArrowFWDDimGlob..
Place these container fields on any layout and enter browse mode to paste the actual arrows into them. You can get the arrow contents from our demo, or download these:
4. Create BackMagic's unstored calc field.
BM requires a single unstored calc field, zz.BackMagic.cr, in each table in your file. (You don't need to create this in tables to which you'll never be navigating. For example, if you have a table of phone numbers, but always look at those in a portal on a contact's layout, you'd only add BM's field to the contacts table, not to the phone numbers table, though it certainly doesn't hurt to add it everywhere.)
If you're using the
separation model where you have separate interface and data files, you'll add this unstored calc to a table in your interface file: probably a settings table. See our notes on using BM with the
separation model for more details.
Make sure this calc returns the type "container". After you've pasted the definition for zz.BackMagic.cr into your file, replace the names of our container fields with those you created (if different) from step 3 above. Once you've done this for one table, the field zz.BackMagic.cr can then be copied and pasted into your other tables without modification.
5. Copy and paste the script "Back FWD ( Direction )" into your file(s).
This script can be pasted without modification. If you want to change the name of the script wait until after you've completed all these steps; for now, leave the script as we've named it.
6. Paste the button controls onto each layout.
Copy the button controller from the BackMagic demo and paste it on to your layout. Note that at first the field won't line up, so right click on the first repetition of the field (to the left of the Back arrow)...
!
...and specify the correct field. Make sure that this instance of zz.BackMagic.cr is from the table occurrence on which the current layout is based. This usually means that when you right click on the field and select "Specify Field" you'll be picking a field from the "Current Table"...
However, if you're using the
separation model, you'll select a table occurrence of your interface table that is
related to the table occurrence on which the current layout is based.
7. Paste an instance of the first repetition of zz.BackMagic.cr on to each of your native FileMaker tabs.
In order for BM to add newly visited tab to the back stack, you'll need to add the "listening" field to each of your tabs. I generally place this in the same place on each tab, usually in the upper left corner. This is the same field that is in the center of the back controller you added in step 6 above.
8. Enjoy!