B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=9.85
@EndOfDesignText@
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=B4XTwoPages.zip

Sub Class_Globals
	Private Root As B4XView
	Private xui As XUI
	
	Private Page1 As B4XPage1
	Private lblPage1 As B4XView
	Private xcbxMainPage As B4XComboBox
	
	Public SelectedIndex As Int	'Selected index from the xMain B4XComboBox
	Public SelectedItem As String	'selected item from the xMain B4XComboBox
End Sub

Public Sub Initialize
	Log("MainPage Init")
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
	Log("MainPage Create")
	
	Root = Root1
	Root.LoadLayout("MainPage")
	
	Page1.Initialize	'initializes Page1
	B4XPages.AddPage("Page 1", Page1)	'adds Page1 to the B4XPages list
	
	FillComboBox
End Sub

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

'Initialize the B4XComboBox 
'Select the first item
Private Sub FillComboBox
	Private i As Int
	Private lst As List
	
	lst.Initialize
	For i = 0 To 10
		lst.Add("Main " & i)
	Next
	xcbxMainPage.SetItems(lst)
	
	xcbxMainPage.SelectedIndex = SelectedIndex
	SelectedItem = xcbxMainPage.SelectedItem 'We memorize the index in the variable
End Sub

'Display Page1
Private Sub btnPage1_Click
	B4XPages.ShowPage("Page 1")
End Sub

Private Sub xcbxMainPage_SelectedIndexChanged (Index As Int)
	SelectedIndex = Index	'We memorize the index in the variable
	SelectedItem = xcbxMainPage.SelectedItem 'We memorize the index in the variable
End Sub

'Updates the MainPage
Public Sub Update
	lblPage1.Text = Page1.SelectedItem
End Sub

