HeaderPane
Main
Hide
Share Link
Print

Tabs

Each tab of a SftTabs/NET control is a TabClass object. The tabs are kept in the control's tab collection, an instance of the TabCollectionClass class, which is accessed using the SftTabs.Tabs property. Languages supporting indexers can use array syntax, usually Tabs[] or Tabs().

Tabs

At design-time, tabs are added, removed and edited using the control's smart tag and its property pages.

Adding and Removing Tabs

New tabs are added using the TabCollectionClass.Add, TabCollectionClass.AddRange and TabCollectionClass.Insert methods. A tab is removed using the TabClass.Remove, TabCollectionClass.Remove or TabCollectionClass.RemoveAt method, all tabs are removed using TabCollectionClass.Clear. The TabCollectionClass.Move method moves a tab to another position.

C#

TabClass tab = sftTabs1.Tabs.Add("Settings");
tab.ToolTip = "Application settings";
tab.Page.Controls.Add(new SettingsControl());

VB

Dim tab As TabClass = SftTabs1.Tabs.Add("Settings")
tab.ToolTip = "Application settings"
tab.Page.Controls.Add(New SettingsControl())

When a tab is added to a control with a client area, the control creates the tab's page. When a tab is removed, its page and the controls on the page are disposed (see Tab Pages).

The TabAdded event occurs after a tab was added, the TabRemoved event after a tab was removed.

When many tabs are added, removed or changed, set the SoftelvdmUserControl.Initializing property to True before the changes and to False once they are complete, which increases performance significantly.

Hidden and Disabled Tabs

A tab is hidden by setting its TabClass.Visible property to False. A hidden tab and its page are not displayed and the tab cannot be selected. The tab remains in the tab collection, so the positions of the other tabs do not change.

A tab is disabled by setting its CellBaseClass.Enabled property to False. A disabled tab is displayed grayed and cannot be selected by the user. When the user clicks a disabled tab, the SwitchingDisabled event occurs. An application can still select a disabled tab using the SftTabs.SelectedIndex or SftTabs.SelectedTab property.

Locating Tabs

A tab's position in the tab collection is returned by its TabClass.Index property. A tab can also be located by name: the TabClass.Name property defines an application-specific name, and the TabCollectionClass.Item property and the TabCollectionClass.IndexOf method accept this name.

The TabClass.Tag, CellBaseClass.TagString and CellBaseClass.TagObject properties attach application-specific data to a tab.

See Also Tab Control Components