UserGuide

Desktop Tab Panel

From Xojo Documentation

A Tab Panel presents separate groups of controls on one or more tabs. The user can switch tabs by clicking on the tab control (usually at the top of the Tab Panel). To add controls to a specific tab, select the tab and then drag the control onto the Tab Panel.

By default, a TabPanel control has two panels. You add, modify, rearrange, or remove panels and tab labels using the Panel Editor. Click the Edit button next to the Panels property in the Tab Panel Inspector to display the Panel Editor.

The Panel Editor works the same as it does for a Page Panel except that you can also rename the panels. You want to do this because the name is what appears in the tabs of the control. To rename a tab, click on it once to get focus and then a second time to edit the name. Type the new name and press enter.

Refer to TabPanel in the Reference Guide for details on all its events, properties and methods.

Tab Panel Library Icon

Below are a list of commonly used events, properties and methods.

Events

PanelChanged

The PanelChanged event handler is called when the SelectedPanelIndex property changes.

Properties

PanelCount

Returns the number of tab panels.

SelectedPanelIndex

Tab Panel Editor
Used to get or set the current panel.

Methods

AddPanel, AddPanelAt, RemovePanelAt

These methods are used to add or remove panels.

CaptionAt

Specify the panel number as a parameter to set the caption text for the tabs.

Usage

To switch tabs, use the SelectedPanelIndex property. This code selects the first tab:

TabPanel1.SelectedPanelIndex = 0

This code changes the caption for the 2nd tab:

Me.CaptionAt(1) = "Second Tab"

Controls that are added to a Tab Panel are referenced in your code by just using the control name as if it were not in a Tab Panel:

PushButton1.Caption = "OK"

See Also

TabPanel class; UserGuide:Desktop Page Panel, UserGuide:Desktop Container Control topics