How It Works
For detailed step by step instructions for adding BackMagic to your solution, see Adding BackMagic to Your File.
Listening (Watching?)
BackMagic (BM) works by listening to all your navigation actions and writing them to a global variable. Actually, to two global variables, one for the "Back stack" (all your possible "back" destinations) and a second for the "FWD stack" (your possible forward destinations).
BM listens through an unstored calc placed on every layout (and on every tab of each layout). This calc is the first repetition of the field zz.BackMagic.cr, but the work is really done by the custom function "SeedCode_BackMagic_Log".
Through this function, BM writes various facts about the layout to the back stack: which facts it choose to record are determined in the custom function "SeedCode_BackMagic_LayoutState".
Finally, when you click "back" or "FWD" our script looks at the back and fwd stacks and decides what to do.
The rest of BM, including the other repetition of the function "SeedCode_BackMagic" are all about displaying the present state of the "Back" and "FWD" buttons. As with many things in FileMaker, this display is trickier than the actual navigation.