Simplifying BackMagic

Using and extending SeedCode's free "back" button technique.
Posts: 3
Joined: Fri Jun 01, 2012 10:51 pm
PostPosted: Sat Jun 02, 2012 7:36 am
Hi John,

I would like to simplify BackMagic by eliminating the repeats in the container field and the graphics they need. I have succeeded in using conditional formatting to modify the global container field behind a transparent .png for the back button and another behind the forward button. However, I would also like to eliminate any code that is redundant.

How would I go about doing this? I'm guessing I would have to modify the custom functions, script and container field calculations.

I did look at this post:
viewtopic.php?f=26&t=1450

Let ( [
$$Nav_BackInactive = ValueCount ( $$Nav_BackStack ) = 1 or MiddleValues ( $$Nav_BackStack ; 2 ; 1 ) = SeedCode_BackMagic_LayoutState & "¶" ;
$$Nav_FWDInactive = IsEmpty ( $$Nav_FWDStack )
];

Choose ( Get ( CalculationRepetitionNumber ) ; "" ;

Let ( address = SeedCode_BackMagic_Log ; "" ) ;

If ( $$Nav_BackInactive ≠1 ; TextColor ( "◀" ; RGB ( 0 ; 170 ; 0 ) ) ; TextColor ( "◀" ; RGB ( 170 ; 170 ; 170 ) ) ) ;

If ( $$Nav_BackInactive ≠1 ; TextColor ( "Back" ; RGB ( 0 ; 170 ; 0 ) ) ; TextColor ( "Back" ; RGB ( 170 ; 170 ; 170 ) ) ) ;


If ( $$Nav_FWDInactive ≠1 ; TextColor ( "FWD" ; RGB ( 0 ; 170 ; 0 ) ) ; TextColor ( "FWD" ; RGB ( 170 ; 170 ; 170 ) ) ) ;


If ( $$Nav_FWDInactive ≠1 ; TextColor ( "▶" ; RGB ( 0 ; 170 ; 0 ) ) ;TextColor ( "▶" ; RGB ( 170 ; 170 ; 170 ) )) ;

)// End Choose
) // End LetOne


I understand changing the repetitions to text, but the changes to the CF function above won't paste into the CF in the file and there appear to be illegal characters. Additionally, I would like to eliminate anything being written to the global (if possible), eliminate the repetitions (also, if possible) and depend just upon the conditional formatting (which does work well).

Any suggestions would be appreciated.

Thank you,
Greg
SeedCode Staff
SeedCode Staff
Posts: 638
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Mon Jun 04, 2012 9:26 am
Hi Greg,

Hope all is well.

You still need the global variables: $$Nav_FWDInactive and $$Nav_BackInactive for the script itself, but you don't need any of the container input or output, so you could just use the following for the CF itself.

Let ( [
address = SeedCode_BackMagic_Log ;
$$Nav_BackInactive = ValueCount ( $$Nav_BackStack ) = 1 or MiddleValues ( $$Nav_BackStack ; 2 ; 1 ) = SeedCode_BackMagic_LayoutState & "¶" ;
$$Nav_FWDInactive = IsEmpty ( $$Nav_FWDStack ) ] ; "" )


The field: zz.BackMagic.cr doesn't need to be repeating or a container, but since it's empty it doesn't really matter.

You still need to make sure at least one occurrence of the field is on the layout and on the tab panels so that it can build the stack.

Let me know of that helps,
Jason
Posts: 3
Joined: Fri Jun 01, 2012 10:51 pm
PostPosted: Sun Jun 10, 2012 12:05 am
Thanks for the help, John.

The CF modification went well. Eliminating the repetitions alone did not lead to errors. However, deleting the calculation within zz.BackMagic.cr or changing it to a text field led to errors when using the script.

I hope to eliminate the global fields in my system table, but the calculation would have to be empty of any references to them for that to work.

Any additional help would be appreciated.
Thanks again.

Greg
SeedCode Staff
SeedCode Staff
Posts: 638
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Mon Jun 11, 2012 8:13 am
Hi Greg,

Hope all is well.

You need the calculation field zz.BackMagic.cr to have the custom function in it. That's how the "stack" is written to the global variables, without it, there's no history.

It shouldn't matter if it's text or a container as all it's doing now is writing the global variables and not returning any value, but it does need to be unstored, so it evaluates when you enter a layout or flip open a tab. You can remove the parameters from the CF as well, as there's no input in this version.

BackMagicText.fp7.zip
(308.44 KiB) Downloaded 76 times


Here's a copy with the parameters and their references removed from the CF and the field itself changed to a single rep with a text result. You really can't take anything else out and still have it work.

hth,
Jason
Posts: 3
Joined: Fri Jun 01, 2012 10:51 pm
PostPosted: Mon Jun 11, 2012 3:53 pm
Thank you very much, John.

It works wonderfully.

Return to BackMagic

Who is online

Users browsing this forum: No registered users and 1 guest

cron