Table of Contents

Class TabView

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Control that hosts multiple sub views, presenting a single one at once.

public class TabView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Inheritance
TabView
Implements
Inherited Members

Constructors

TabView()

Initializes a TabView class.

Fields

DefaultMaxTabTextWidth

The default MaxTabTextWidth to set on new TabView controls.

Properties

MaxTabTextWidth

The maximum number of characters to render in a Tab header. This prevents one long tab from pushing out all the others.

SelectedTab

The currently selected member of Tabs chosen by the user.

Style

Render choices for how to display tabs. After making changes, call ApplyStyleChanges().

TabScrollOffset

When there are too many tabs to render, this indicates the first tab to render on the screen.

Tabs

All tabs currently hosted by the control.

Methods

AddTab(Tab, bool)

Adds the given tab to Tabs.

ApplyStyleChanges()

Updates the control to use the latest state settings in Style. This can change the size of the client area of the tab (for rendering the selected tab's content). This method includes a call to SetNeedsDraw().

Dispose(bool)

Disposes the control and all Tabs.

EnsureSelectedTabIsVisible()

Updates TabScrollOffset to ensure that SelectedTab is visible.

EnsureValidScrollOffsets(int)

Updates TabScrollOffset to be a valid index of Tabs.

OnDrawingContent()

Called when the View's content is to be drawn. The default implementation does nothing.

OnHasFocusChanged(bool, View?, View?)

Invoked after HasFocus has changed. This method is called before the HasFocusChanged event is raised.

OnSelectedTabChanged(Tab, Tab)

Raises the SelectedTabChanged event.

RemoveTab(Tab?)

Removes the given tab from Tabs. Caller is responsible for disposing the tab's hosted View if appropriate.

SwitchTabBy(int)

Changes the SelectedTab by the given amount. Positive for right, negative for left. If no tab is currently selected then the first tab will become selected.

Events

SelectedTabChanged

Event for when SelectedTab changes.

TabClicked

Event fired when a Tab is clicked. Can be used to cancel navigation, show context menu (e.g. on right click) etc.