Sub Class_Globals
Private Root As B4XView
Private xui As XUI
' --- Give access from other B4XPages
Public OP As B4XOtherPage
Public MP As B4XMainPage
Public MPstr As String
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
B4XPages.SetTitle(Me, "Main Page")
OP.Initialize
B4XPages.AddPage("OtherPage", OP)
' --- Define variable and access
MPstr = "This is B4XMainPage variable"
MP = B4XPages.MainPage
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
Log($"Content from B4XOtherPage: ${OP.OPstr} in B4XMainPage"$)
B4XPages.ShowPage("OtherPage")
End Sub