iOS Question Back Button and activity resume

Discussion in 'iOS Questions' started by Marco Maria Vilucchi, Jul 14, 2015.

  1. Marco Maria Vilucchi

    Marco Maria Vilucchi Active Member Licensed User

    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

    upload_2015-7-14_8-53-9.png
     

    Attached Files:

  2. imbault

    imbault Well-Known Member Licensed User

    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:
    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:
    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:
    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:
    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
  3. Marco Maria Vilucchi

    Marco Maria Vilucchi Active Member Licensed User

    Ths
    Seems complicated but i try......
     
Loading...