I like to close a TabPage in code by name, no idea how
B4X:
Sub CloseTab(inp As String)
For Each v As Node In MainForm.RootPane.GetAllViewsRecursive
If v Is TabPane Then
Dim a As TabPane
a = v
Dim l As List
l.Initialize
l.AddAll(a.Tabs)
Dim x As Int = 0
For x = 0 To l.Size - 1
Dim az As TabPage = l.Get(x)
If az.Text = inp Then
'close this Tab
End If
Next
End If
Next
End Sub
Sub MainForm_MouseClicked (EventData As MouseEvent)
CloseTab(TabPane1.Tabs.Get(1))
End Sub
Sub CloseTab (tb As TabPage)
Dim jo As JavaObject = tb
jo = jo.RunMethodJO("getTabPane", Null).RunMethodJO("getSkin", Null).RunMethodJO("getBehavior", Null)
jo.RunMethod("closeTab", Array(tb))
End Sub
Find a tab based on its text:
B4X:
Sub TabByTitle(tp As TabPane, Title As String) As TabPage
For Each tb As TabPage In tp.Tabs
If tb.Text = Title Then Return tb
Next
Return Null
End Sub