Custom Functions

Using and extending SeedCode's free "back" button technique.
Posts: 2
Joined: Wed Aug 24, 2011 2:27 pm
PostPosted: Thu Dec 01, 2011 8:51 am
Having a hell of a time regarding custom functions. I have three done in the exact order as specified in the BM install but I get the dreaded too many parameters error when trying to do this one.

SeedCode_BackMagic_Log


The error occurs in this line
changed = If ( SeedCode_GetValue ( topofstack ; "LayoutNumber" ) ≠ SeedCode_GetValue

Complete script seen below - I am running FM 11 advanced. Any help would be really appreciated. as I need the back button to work.


/*

Name:
SeedCode_BackMagic_Log

History:
Created by John Sindelar, SeedCode LLC
www.seedcode.com
Creation Date: 1 Feb 2005
Last Modified Date: 21 Feb 2007

Purpose:
Manages the Back and FWD stacks when we're navigating "by hand", that is when we're not explicitly clicking "Back" or "FWD".

Parameters:
None

Example:
Since this has no parameters you always call it like this: SeedCode_BackMagic_Log

Requires Other Custom Functions:
SeedCode_BackMagic_LayoutState
SeedCode_GetValue

Other Notes:
If included in an unstored calc on a layout this function will populate BackMagic's back stack.
We include this as the first repetition of the function: SeedCode_BackMagic

Options:
Note that the code below includes a line that can be uncommented to change how BackMagic behaves.

*/

Let ( [
navaddress = SeedCode_BackMagic_LayoutState ;
topofstack = Substitute ( LeftValues ( $$Nav_BackStack ; 1 ) ; "¶" ; "" ) ;
changed = If ( SeedCode_GetValue ( topofstack ; "LayoutNumber" ) ≠ SeedCode_GetValue ( navaddress ; "LayoutNumber" ) or
SeedCode_GetValue ( topofstack ; "TabObjectName" ) ≠ SeedCode_GetValue ( navaddress ; "TabObjectName" ) ; 1 ; 0 )

/*

Options:
By default BackMagic records each native FileMaker tab to the back stack.
Meaning, that as you click from native tab A to native tab B on the same layout, we grab each as a full fleged destination in its own right.
And clicking "Back" will take you from native tab B to native tab A on the same layout.
You may, however, wish to omit such actions from the back stack and only use "back" to switch layouts, ignoring navigation from tab to tab within the same layout.
In this usage, BackMagic would only record the "last visited" tab on each layout you're on.
Uncomment the following the following "changed = ..." line to effect this change and only write the "last visited" native FileMaker tab to the back stack.

*/

// ; changed = SeedCode_GetValue ( topofstack ; "LayoutNumber" ) ≠ SeedCode_GetValue ( navaddress ; "LayoutNumber" )

] ;

// Manage the back stack.

If ( LeftValues ( $$Nav_BackStack ; 1 ) ≠ navaddress & "¶" ; // the nav address has changed.
If ( changed = 0 ; // but we're still on the same layout.
Let ( $$Nav_BackStack = navaddress & ¶ & RightValues ( $$Nav_BackStack ; ValueCount ( $$Nav_BackStack ) -1 ) ; "" ) ; // swap out the fist line of the back stack for the new address.
Let ( $$Nav_BackStack = navaddress & ¶ & $$Nav_BackStack ; "" ) // if a different layout, add the whole address to the back stack.
) // End If
) & // End If

// Manage the FWD stack.

If ( $$Nav_InUse ≠ "Yes" and changed = 1 ; Let ( $$Nav_FWDStack = "" ; "" ) ) &
Let ( $$Nav_InUse = "" ; "" )

) // End Let

// End
Posts: 2
Joined: Wed Aug 24, 2011 2:27 pm
PostPosted: Thu Dec 01, 2011 3:54 pm
Import saved the day. Problem solved.
SeedCode Staff
SeedCode Staff
Posts: 2546
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Dec 01, 2011 5:02 pm
Glad to hear it; thanks!
John Sindelar
SeedCode LLC

Return to BackMagic

Who is online

Users browsing this forum: No registered users and 0 guests

cron
(855) SEEDCODE
support@seedcode.com
Follow us: