David Hawkins Active Member Licensed User Longtime User Jun 21, 2023 #1 Hi I have an App with 18 pages all of which are loaded using the following code (this is only showing page 6) The code below is in B4XMainPage Code: Sub Class_Globals Public Page6 As CompanyList End Sub Public Sub Initialize ' B4XPages.GetManager.LogEvents = True Page6.Initialize End Sub 'This event will be called once, before the page becomes visible. Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("Login") B4XPages.AddPage("CompanyList", Page6) End Sub The code for loading a page is Code: Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 'load the layout to Root Root.LoadLayout("ListOfCompanies") s_Menu = Array As String("New Company/Location", "New User", "Remove User", "Group Emails", "Password") End Sub and it fails with the following error Target is null. Method called: _initialize::: I have stepped through the code and the page is being initialized What is going on? OK now sorted the flexgrid on the page was causing a problem I replaced it and now all is working Last edited: Jun 21, 2023
Hi I have an App with 18 pages all of which are loaded using the following code (this is only showing page 6) The code below is in B4XMainPage Code: Sub Class_Globals Public Page6 As CompanyList End Sub Public Sub Initialize ' B4XPages.GetManager.LogEvents = True Page6.Initialize End Sub 'This event will be called once, before the page becomes visible. Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("Login") B4XPages.AddPage("CompanyList", Page6) End Sub The code for loading a page is Code: Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 'load the layout to Root Root.LoadLayout("ListOfCompanies") s_Menu = Array As String("New Company/Location", "New User", "Remove User", "Group Emails", "Password") End Sub and it fails with the following error Target is null. Method called: _initialize::: I have stepped through the code and the page is being initialized What is going on? OK now sorted the flexgrid on the page was causing a problem I replaced it and now all is working
walterf25 Expert Licensed User Longtime User Jun 22, 2023 #2 David Hawkins said: Page6.Initialize Click to expand... Try moving this line to the B4XPage_Created sub instead. Upvote 0
David Hawkins said: Page6.Initialize Click to expand... Try moving this line to the B4XPage_Created sub instead.
David Hawkins Active Member Licensed User Longtime User Jun 23, 2023 #3 walterf25 said: Try moving this line to the B4XPage_Created sub instead. Click to expand... Hi walter25 thank you for your response it is much appreciated, however the problem was a Flexgrid on the page I was trying to open, I replaced the Flexgrid and all is working OK now. Many regards David Upvote 0
walterf25 said: Try moving this line to the B4XPage_Created sub instead. Click to expand... Hi walter25 thank you for your response it is much appreciated, however the problem was a Flexgrid on the page I was trying to open, I replaced the Flexgrid and all is working OK now. Many regards David