I am calling a page from one sub which loads ok the FIRST time.
If I call the same sub the PageCreate is obviously ignored. I need to change the color of a panel on the page that is called, so first time is ok but every call after that fails.
I have declared the panel as public is the sub I call but it fails. Page Appear event returns panel not init which is correct as it's added in the designer.
How can I access the panel object?
B4X:
'Call the page (First time all is well)
Dim fn As String = localDWG.Get(Index-1)
ToastMessageShow("clv " & fn,True)
B4XPages.MainPage.selectedDWG=fn
B4XPages.ShowPageAndRemovePreviousPages("pgAddNewItem")
B4XPages.MainPage.pgAddNew.pnlmarker.Color=Colors.Magenta' < Ok the first time only
'In page I call
public Sub B4XPage_Appear
ToastMessageShow("B4XPage_Appear",True)
pnlmarker.Color=Colors.Magenta < !! Not initialized
End Sub'
B4XPages are simpler than activities. No need to update the state in the Appear event.
Are you adding the page with B4XPages.AddPageAndCreate? This way you will not need to wait for the page to be created when it is shown for the first time.