5 Replies Latest reply on Jun 4, 2012 2:06 PM by bill1650

    Implementing a "back" button

    MichaelVoccola

      Title

      Implementing a "back" button

      Post

      I have used a script to create a "back" button that will allow the user to navigate back through their layout history. A script trigger is placed on all the layouts:

       

      OnLayoutEnter:

      Set Variable [$$Stack; Value:Get ( LayoutName ) & ¶ & $$Stack]

       

      Each layout has a button on it running the following script:

       

      Set Variable [$Layout; Value:GetValue ( $$Stack ; 2 )]

      Set Variable [$$Stack; Value:RightValues ( $$Stack ; ValueCount ( $$Stack ) -2)]

       

      The issue here, is that when a user reaches the bottom of the stack (hits the 'back' button more times than there are values in the stack), the script stops working until the user has navigated to the equivilent number of 'new' layouts, building the stack back up. Example: a user clicks the back button twice after already reaching the end of the stack, the user must now navigate to three more layouts before the script actually begins working again - the stack seems to have a negative value.

      Any ideas on how to avoid navigating past the bottom, resulting in a negative stack?

      The link below is a sample file containing some layouts and the two scripts.

       

      https://www.dropbox.com/s/q5gth8f1g79kdbx/Back%20Button.fmp12