2. B4X page and menu
If you want to use the CategoryPage then you have to write code for it.
In the B4XMainPage Class_Globals subroutine declare a variable for the page:
private catpage as CategoryPage
Add the following code to the B4XPage_Created subroutine below the LoadLayout statement:
B4XPages.SetTitle(Me,"Mybudget")
catpage.Initialize ' don't forget to initialize!
B4XPages.AddPage("Category",catpage)
We also provided a title for our app in the first line we added.
In the CategoryPage tab add code for the loading of the layout and for setting the page title.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("cat_layout")
B4XPages.SetTitle(Me,"Mybudget - category")
End Sub
This code takes care of the loading of the Category page but we can't access it yet.
We need a menu item on the application bar.
In a previous tutorial you can find how to do this. Link:
B4A-Lists section B4XMainPage.
Insert a line of code in the subroutine B4XPage_created from the B4XMainPage tab to call the menu item below the line to add the page.
menuitem_add(Me, "Category")