Marco Maria Vilucchi Active Member Licensed User Longtime User Jul 14, 2015 #1 Hi, when i press "back" the App return to main page. On Android i can use Activity_Resume. How can i intercept "back" button pression on B4I? Can someone help me? Ths Marco Attachments upload_2015-7-14_8-47-29.png 100.2 KB · Views: 510
Hi, when i press "back" the App return to main page. On Android i can use Activity_Resume. How can i intercept "back" button pression on B4I? Can someone help me? Ths Marco
imbault Well-Known Member Licensed User Longtime User Jul 14, 2015 #2 There must be several methods, the one I have used is working with variables, let's say LastPage for saving lastpage and Pb used in all pages So in main Code: Copy Sub Process_Globals Private LastPage="" As String Public Pb ="" as String Private HomeScreen As Page .... Private Sub Application_Start (Nav As NavigationController) HomeScreen.Initialize("HomePage") Let's say your main page calls a Parameter page, before calling parameters.show, just do: Code: Copy LastPage = "parameters" parameters.show In Parameter, you can intercept the page is going to "back" in this Sub Page_Disappear , and saving what you want before page really disappears: Code: Copy Private Sub parameters_Disappear If PwrM <= PwrL Then Main.Pb = Main.Pb & "Warning PowerM Should be Greater than PowerL" & CRLF End If ... In Main, a Sub will be raises, Page_Appear, here you can check the LastPage and pb Code: Copy Private Sub HomePage_Appear If LastPage <> "" Then ' handle saves If LastPage = "parameters" Then If Pb <> "" Then Msgbox(Pb,"Please fix errors in Parameters") Pb = "" parameters.Show End If End If LastPage = "" End If End Sub Hope this will show you how to do Last edited: Jul 14, 2015 Upvote 0
There must be several methods, the one I have used is working with variables, let's say LastPage for saving lastpage and Pb used in all pages So in main Code: Copy Sub Process_Globals Private LastPage="" As String Public Pb ="" as String Private HomeScreen As Page .... Private Sub Application_Start (Nav As NavigationController) HomeScreen.Initialize("HomePage") Let's say your main page calls a Parameter page, before calling parameters.show, just do: Code: Copy LastPage = "parameters" parameters.show In Parameter, you can intercept the page is going to "back" in this Sub Page_Disappear , and saving what you want before page really disappears: Code: Copy Private Sub parameters_Disappear If PwrM <= PwrL Then Main.Pb = Main.Pb & "Warning PowerM Should be Greater than PowerL" & CRLF End If ... In Main, a Sub will be raises, Page_Appear, here you can check the LastPage and pb Code: Copy Private Sub HomePage_Appear If LastPage <> "" Then ' handle saves If LastPage = "parameters" Then If Pb <> "" Then Msgbox(Pb,"Please fix errors in Parameters") Pb = "" parameters.Show End If End If LastPage = "" End If End Sub Hope this will show you how to do
Marco Maria Vilucchi Active Member Licensed User Longtime User Jul 14, 2015 #3 Ths Seems complicated but i try...... Upvote 0