Rattigan_Roger Member Licensed User Longtime User Dec 23, 2023 #1 I am certain the answer is plainly explained somewhere here but I can't seem to find it. I am working on my first B$X project, although I have written several Apps in B4i, B4A, B4J and B$R. I have a two page app. When the user finishes with the second page and uses a back arrow to the information he/she placed in the first page is discarded and the first page is used again. The info is entered through a series of switches. Before the user goes back to the first page I reset all the switches and clear out the public variables. The user then enters the info through the switches and then goes to the second page. Try as I might, the info on the second page never gets changed. The backbutton code is as follows [CODE lang="b4x" title="BACK BUTTON"]Private Sub backBtn_Click Utility.DisplaySchem = "" Utility.WrkingSchem = "" Utility.TheIconFile = "" B4XPages.ClosePage(Me) B4XPages.ShowPage("Mainpage") End Sub [/CODE] "Utility" is a public code module. The switches are reset on the first page just prior to advancing to the second. What am I doing wrong or not doing right? Thanking You in advance for Your time and trouble.
I am certain the answer is plainly explained somewhere here but I can't seem to find it. I am working on my first B$X project, although I have written several Apps in B4i, B4A, B4J and B$R. I have a two page app. When the user finishes with the second page and uses a back arrow to the information he/she placed in the first page is discarded and the first page is used again. The info is entered through a series of switches. Before the user goes back to the first page I reset all the switches and clear out the public variables. The user then enters the info through the switches and then goes to the second page. Try as I might, the info on the second page never gets changed. The backbutton code is as follows [CODE lang="b4x" title="BACK BUTTON"]Private Sub backBtn_Click Utility.DisplaySchem = "" Utility.WrkingSchem = "" Utility.TheIconFile = "" B4XPages.ClosePage(Me) B4XPages.ShowPage("Mainpage") End Sub [/CODE] "Utility" is a public code module. The switches are reset on the first page just prior to advancing to the second. What am I doing wrong or not doing right? Thanking You in advance for Your time and trouble.
Alexander Stolte Expert Licensed User Longtime User Dec 23, 2023 #2 Rattigan_Roger said: B4XPages.ClosePage(Me) B4XPages.ShowPage("Mainpage") Click to expand... Use ShowPageAndRemovePreviousPages B4X: B4XPages.ShowPageAndRemovePreviousPages("Mainpage") It would definitely be helpful if you could create an example project. Otherwise I can't figure out what you're doing wrong. Thanks. Upvote 0
Rattigan_Roger said: B4XPages.ClosePage(Me) B4XPages.ShowPage("Mainpage") Click to expand... Use ShowPageAndRemovePreviousPages B4X: B4XPages.ShowPageAndRemovePreviousPages("Mainpage") It would definitely be helpful if you could create an example project. Otherwise I can't figure out what you're doing wrong. Thanks.
Rattigan_Roger Member Licensed User Longtime User Dec 23, 2023 #3 Yes, here it is. Thank You I think this illustrates my ignorance Attachments exmpl.zip exmpl.zip 171.4 KB · Views: 381 Upvote 0
Alexander Stolte Expert Licensed User Longtime User Dec 23, 2023 #4 Now I see the problem. You use the "LoadSchematic" function only in the B4XPage_Created event. But the event is only triggered once, when the page is used for the first time. Either you use the B4XPage_Appear event or you call the function when you open the page, like: B4X: Private Sub Go_btn_Click File.WriteString(File.DirDocuments,"test.txt",Textfield1.text) Textfield1.text = "" B4XPages.ShowPage("schematic") SchemPage.LoadSchematic End Sub Upvote 1
Now I see the problem. You use the "LoadSchematic" function only in the B4XPage_Created event. But the event is only triggered once, when the page is used for the first time. Either you use the B4XPage_Appear event or you call the function when you open the page, like: B4X: Private Sub Go_btn_Click File.WriteString(File.DirDocuments,"test.txt",Textfield1.text) Textfield1.text = "" B4XPages.ShowPage("schematic") SchemPage.LoadSchematic End Sub
Rattigan_Roger Member Licensed User Longtime User Dec 23, 2023 #5 Thank You so much for the help. Upvote 0
Alexander Stolte Expert Licensed User Longtime User Dec 23, 2023 #6 Rattigan_Roger said: Thank You so much for the help. Click to expand... I have to thank you for the coffee Upvote 0
Rattigan_Roger said: Thank You so much for the help. Click to expand... I have to thank you for the coffee