Search Results for

Show / Hide Table of Contents

# Class TabView

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

##### Inheritance

System.Object
Responder
View
TabView

##### Implements

System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize

##### Inherited Members

View.Added
View.Removed
View.Enter
View.Leave
View.MouseEnter
View.MouseLeave
View.MouseClick
View.CanFocusChanged
View.EnabledChanged
View.VisibleChanged
View.HotKeyChanged
View.HotKey
View.HotKeySpecifier
View.Shortcut
View.ShortcutTag
View.ShortcutAction
View.Data
View.Driver
View.Subviews
View.TabIndexes
View.TabIndex
View.TabStop
View.CanFocus
View.Id
View.IsCurrentTop
View.WantMousePositionReports
View.WantContinuousButtonPressed
View.Frame
View.LayoutStyle
View.Bounds
View.X
View.Y
View.Width
View.Height
View.SuperView
View.SetNeedsDisplay()
View.ClearLayoutNeeded()
View.SetNeedsDisplay(Rect)
View.SetChildNeedsDisplay()
View.Add(View)
View.Add(View[])
View.RemoveAll()
View.Remove(View)
View.BringSubviewToFront(View)
View.SendSubviewToBack(View)
View.SendSubviewBackwards(View)
View.BringSubviewForward(View)
View.Clear()
View.Clear(Rect)
View.ScreenToView(Int32, Int32)
View.ClipToBounds()
View.SetClip(Rect)
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Attribute, Attribute)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.Move(Int32, Int32, Boolean)
View.PositionCursor()
View.HasFocus
View.OnAdded(View)
View.OnRemoved(View)
View.OnEnter(View)
View.OnLeave(View)
View.Focused
View.MostFocused
View.ColorScheme
View.AddRune(Int32, Int32, Rune)
View.ClearNeedsDisplay()
View.DrawContent
View.OnDrawContent(Rect)
View.DrawContentComplete
View.OnDrawContentComplete(Rect)
View.SetFocus()
View.KeyPress
View.InvokeKeybindings(KeyEvent)
View.AddKeyBinding(Key, Command)
View.ReplaceKeyBinding(Key, Key)
View.ContainsKeyBinding(Key)
View.ClearKeybindings()
View.ClearKeybinding(Key)
View.ClearKeybinding(Command)
View.AddCommand(Command, Func<Nullable<Boolean>>)
View.GetSupportedCommands()
View.GetKeyFromCommand(Command)
View.ProcessHotKey(KeyEvent)
View.ProcessColdKey(KeyEvent)
View.KeyDown
View.OnKeyDown(KeyEvent)
View.KeyUp
View.OnKeyUp(KeyEvent)
View.EnsureFocus()
View.FocusFirst()
View.FocusLast()
View.FocusPrev()
View.FocusNext()
View.LayoutStarted
View.LayoutComplete
View.Initialized
View.LayoutSubviews()
View.Text
View.AutoSize
View.TextAlignment
View.VerticalTextAlignment
View.TextDirection
View.IsInitialized
View.Enabled
View.Visible
View.Border
View.ToString()
View.OnMouseEnter(MouseEvent)
View.OnMouseLeave(MouseEvent)
View.OnMouseEvent(MouseEvent)
View.OnMouseClick(View.MouseEventArgs)
View.OnCanFocusChanged()
View.OnEnabledChanged()
View.OnVisibleChanged()
View.BeginInit()
View.EndInit()
View.SetWidth(Int32, Int32)
View.SetHeight(Int32, Int32)
View.GetCurrentWidth(Int32)
View.GetCurrentHeight(Int32)
View.GetNormalColor()
View.GetTopSuperView()
Responder.MouseEvent(MouseEvent)
Responder.Dispose()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class TabView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize

### Constructors

#### TabView()

Initialzies a TabView class using Computed layout.

##### Declaration

    public TabView()

### Fields

#### DefaultMaxTabTextWidth

The default MaxTabTextWidth to set on new TabView controls

##### Declaration

    public const uint DefaultMaxTabTextWidth = 30U

##### Field Value

Type | Description
--- | ---
System.UInt32 |

### Properties

#### MaxTabTextWidth

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

##### Declaration

    public uint MaxTabTextWidth { get; set; }

##### Property Value

Type | Description
--- | ---
System.UInt32 |

#### SelectedTab

The currently selected member of Tabs chosen by the user

##### Declaration

    public TabView.Tab SelectedTab { get; set; }

##### Property Value

Type | Description
--- | ---
TabView.Tab |

#### Style

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

##### Declaration

    public TabView.TabStyle Style { get; set; }

##### Property Value

Type | Description
--- | ---
TabView.TabStyle |

#### Tabs

All tabs currently hosted by the control

##### Declaration

    public IReadOnlyCollection<TabView.Tab> Tabs { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<TabView.Tab> |

#### TabScrollOffset

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

##### Declaration

    public int TabScrollOffset { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

### Methods

#### AddTab(TabView.Tab, Boolean)

Adds the given `tab` to Tabs

##### Declaration

    public void AddTab(TabView.Tab tab, bool andSelect)

##### Parameters

Type | Name | Description
--- | --- | ---
TabView.Tab | tab |
System.Boolean | andSelect | True to make the newly added Tab the SelectedTab

#### 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 SetNeedsDisplay()

##### Declaration

    public void ApplyStyleChanges()

#### Dispose(Boolean)

Disposes the control and all Tabs

##### Declaration

    protected override void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | disposing |

##### Overrides

View.Dispose(Boolean)

#### EnsureSelectedTabIsVisible()

Updates TabScrollOffset to ensure that SelectedTab is visible

##### Declaration

    public void EnsureSelectedTabIsVisible()

#### EnsureValidScrollOffsets()

Updates TabScrollOffset to be a valid index of Tabs

##### Declaration

    public void EnsureValidScrollOffsets()

##### Remarks

Changes will not be immediately visible in the display until you call SetNeedsDisplay()

#### OnSelectedTabChanged(TabView.Tab, TabView.Tab)

Raises the SelectedTabChanged event

##### Declaration

    protected virtual void OnSelectedTabChanged(TabView.Tab oldTab, TabView.Tab newTab)

##### Parameters

Type | Name | Description
--- | --- | ---
TabView.Tab | oldTab |
TabView.Tab | newTab |

#### ProcessKey(KeyEvent)

##### Declaration

    public override bool ProcessKey(KeyEvent keyEvent)

##### Parameters

Type | Name | Description
--- | --- | ---
KeyEvent | keyEvent |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

View.ProcessKey(KeyEvent)

#### Redraw(Rect)

##### Declaration

    public override void Redraw(Rect bounds)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | bounds |

##### Overrides

View.Redraw(Rect)

#### RemoveTab(TabView.Tab)

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

##### Declaration

    public void RemoveTab(TabView.Tab tab)

##### Parameters

Type | Name | Description
--- | --- | ---
TabView.Tab | tab |

#### SwitchTabBy(Int32)

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

##### Declaration

    public void SwitchTabBy(int amount)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | amount |

### Events

#### SelectedTabChanged

Event for when SelectedTab changes

##### Declaration

    public event EventHandler<TabView.TabChangedEventArgs> SelectedTabChanged

##### Event Type

Type | Description
--- | ---
System.EventHandler<TabView.TabChangedEventArgs> |

### Implements

System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize