Took a bit of hunting to find a method to disable a tab in the TabPane and the method I found wasn't quite what I've been looking for.
If you already have your TabPage declared you could also use:
I'm sure someone will now point me to where this has already been posted, but I couldn't find it
After looking into the setDisable method I've come up with the following which works well using the TabPane and the index of the tab.You can disable all tabs except of one tab:
Use this sub to disable all tabs except of the one you want to show.B4X:
Sub DisableAllTabsExceptOf(TabPane As TabPane, page As TabPage) For Each tp As TabPage In TabPane.Tabs Dim jo As JavaObject = tp jo.RunMethod("setDisable", Array(tp <> page)) Next End Sub
Public Sub DisableTabPage(tPane As TabPane, Index As Int, Disable As Boolean) Dim tabs As List = tPane.Tabs Dim tPage As TabPage = tabs.Get(Index) Dim jo As JavaObject = tPage jo.RunMethod("setDisable", Array(Disable)) End Sub
Public Sub DisablePage(tPage As TabPage, Disable As Boolean) Dim jo As JavaObject = tPage jo.RunMethod("setDisable", Array(Disable)) End Sub