Unknown error (to me)...Attempting to do a ChangeForm with ''form name" as a variable

Helen Sandoz showed me a way to have the ‘navigation Icons’ display on every Form… I’ve done that with the attached test app. Now I’m attempting to write the code that goes with each Icon… My intent for the “Move forward one Form” and “Move back one Form” was to capture the Form # (all my forms are called “FormN” where N starts at 0 (after the TOC Form) and ends with the last Form, around 35 or 40)… then, in a variable, concatenate “Form” with the current form ‘number’ + or minus 1. You can see this in the code under Form3 of the attached.

What happens when I push Button 1 on Form3 (it should take me to Form1) is to get the error message captured in the second attachment below… I have no idea what that error message means and I don’t know how to get to the line number referenced.

I hope the problem is NOT to do with Helen’s solution (which is in the code of Form1 in this test app.)…

Tom

PS: Running most recent AppStudio on Windows 10, Chrome, iPad mini and LG Venture.

Test_AppendChild.nsx (42.5 KB)

ChangeForm needs a reference to the form, not the form id:

http://wiki.nsbasic.com/ChangeForm

ChangeForm(Form2)

not the name of the form

ChangeForm("Form2")  ' will not work

It seems to me that you are confusing the issue by using the function Button1_onclick() which on Form 3 is clearly marked to go to Form 1 and only needs the simple command ‘ChangeForm(Form1)’

What you want is for the icons to respond properly on each form. You will need to identify which form is visible when the icon is tapped. NSB has a function for that - NSB.CurrentForm which returns the id of the visible form, for example “ThisForm=NSBCurrentForm.id”

You will then need a branching statement:
If ThisForm=“Form3” Then
ChangeForm(Form2)
ElseIf ThisForm=“Form2” Then

….etcetera

Helen

Hi Helen… The buttons were on the 'Test…" app just to make it easier to go form to form… In the real app, it will be done differently.

Thanks for your input and help…

Tom

This new(?) line in the ChangeForm Wiki really helped…

ChangeForm(window["Form" & i])

Thanks!