iOS Question How to kill the previous pages

Discussion in 'iOS Questions' started by ciginfo, Mar 29, 2015.

  1. ciginfo

    ciginfo Active Member Licensed User

    In the code below, two questions.
    1°) Why the green and yellow do not appear on the page when I call respectively 'Cherche.RootPanel.Color = Colors.Green' and 'Cherche.RootPanel.Color = Colors.Yellow' with the segmentedcontrol1?
    2°) How to kill the precedent page when i use segmentedcontrol1 ? When I used alternately segments segmentedcontrol1 I display the appropriate pages, but when I want to return to Page1 using the top bar left backButton I see through all the previous pages before reaching Page1 ? (See attached file)
    Code:
    'Code module
    #Region  Project Attributes
        
    #ApplicationLabel: B4i Example
        
    #Version: 1.0.0
        
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
        #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
        
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #End Region

    Sub Process_Globals
        
    Public NavControl As NavigationController
        
    Private Page1, Cherche As Page
        
    Private LblCherche, LblBJ, LblLayoutMain As Label
        
    Private BtnCherche As Button
        
    Private segmentedcontrol1 As SegmentedControl

    End Sub

    Private Sub Application_Start (Nav As NavigationController)
        NavControl = Nav
        Page1.Initialize(
    "Page1")
        Page1.Title = 
    "SittingBreak"
        Page1.RootPanel.Color = 
    Colors.White
        NavControl.ShowPage(Page1)
        Page1.RootPanel.LoadLayout(
    "Main")
    End Sub
    Sub BtnCherche_Click
        Cherche.Initialize(
    "Cherche")
        Cherche.RootPanel.LoadLayout(
    "Cherche")
        Cherche.Title = 
    "Cherche"
        LblBJ.Text = 
    "Bonjour"
        segmentedcontrol1.BringToFront
        NavControl.ShowPage(Cherche)
    End Sub
    Sub SegmentedControl1_IndexChanged (Index As Int)
    Select Index
        
    Case 0
            Cherche.Initialize(
    "Cherche")
            Cherche.RootPanel.Color = 
    Colors.Green
            Cherche.RootPanel.LoadLayout(
    "Cherche")
            Cherche.Title = 
    "Cherche"
            LblBJ.Text = 
    "Bonjour"
            segmentedcontrol1.BringToFront
            NavControl.ShowPage(Cherche)
        
    Case 1
            Cherche.Initialize(
    "Cherche")
            Cherche.RootPanel.Color = 
    Colors.Yellow
            Cherche.RootPanel.LoadLayout(
    "Cherche")
            Cherche.Title = 
    "Cherche"
            LblBJ.Text = 
    "Bonsoir"
            segmentedcontrol1.BringToFront
            NavControl.ShowPage(Cherche)
    End Select
    End Sub
    Private Sub Page1_Resize(Width As Int, Height As Int)
       
    End Sub

    Private Sub Application_Background
       
    End Sub
     

    Attached Files:

  2. klaus

    klaus Expert Licensed User

    The problem is that you initialize every time a new Page !
    Remove
    Cherche.Initialize("Cherche")
    Cherche.RootPanel.LoadLayout("Cherche")

    from the subroutines and add it in Application_Start.
     

    Attached Files:

  3. ciginfo

    ciginfo Active Member Licensed User

    OK I understand. Thank you very much.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice