Hello, we're in a different time zone, so I am just seeing this.
I tested my solution and it worked here. But I was wrong.
The problem is that you have the TabPane defined as a general B4XView. That means that the specific features of TabPane are not avaliable
Just define tp as TabPane in the Main routine and change things back to the way you had it. It will work as expected.
Note that the loadlayout of TabPane has an extra parameter, which is the title on the Tab.
Main.tp.LoadLayout("2", "12345")
You also have to modify your main. Tabs are created by the TabPane, not externally by you. Remove the buttons from Layout1
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Public tp As TabPane
Private newtab As new_tab
Private newtab2 As tab2
End Sub
Sub AppStart(Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
newtab.Initialize
newtab2.Initialize
End Sub