B4J=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=8.5
@EndOfDesignText@
Sub Class_Globals
	Private Root As B4XView 'ignore
	Private xui As XUI 'ignore
	
	Private MP As B4XMainPage
	Private btnPage3 As B4XView
End Sub

'You can add more parameters here.
Public Sub Initialize As Object
	Return Me
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
	Log("Page2 Create")
	Root = Root1
	'load the layout to Root
	Root.LoadLayout("Page2")
	
	MP = B4XPages.MainPage
End Sub

Private Sub B4XPage_Appear
	Log("Page2 Appear")
	If MP.NavigationIndex = 2 Then '1 > 2 > 1   1 > 3 > 1
		btnPage3.Visible = False
	Else
		btnPage3.Visible = True
	End If
End Sub

Private Sub B4XPage_Disappear
	Log("Page2 Disappear")
End Sub

Private Sub B4XPage_Foreground
	Log("Page2 Foreground")
End Sub

Private Sub B4XPage_Background
	Log("Page2 Background")
End Sub

Private Sub B4XPage_Resize (Width As Int, Height As Int)
	Log("Page2 Resize " & Width & " / " & Height)
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Sub btnPage3_Click
	B4XPages.ShowPage("Page 3")
	If MP.NavigationIndex = 1 Then	'1 > 2 > 3 > 1
		B4XPages.ClosePage(Me)		'this does not work in B4i !!!
	End If
End Sub
