The TabPane container allows the user to switch between different tab pages.
Working with TabPane is similar to working with SplitPane. Each page is made of a different layout file.
The most important point is to use anchors in the pages layouts. This way the layouts will be resized automatically when the TabPane is resized.
For example the following code adds two pages. The second parameter is the tab title.
Tab1 and Tab2 are layout files.
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
MainForm.RootPane.LoadLayout("Main")
TabPane1.LoadLayout("Tab1", "Tab 1")
TabPane1.LoadLayout("Tab2", "Tab 2")
MainForm.Show
End Sub
TabPane.LoadLayout returns a TabPage object. You can use this object to further configure the page.
The example is attached.
Attachments
Last edited: