Show / Hide Table of Contents

Class Table

A scrollable table control.

Inheritance
object
ControlBase
CompositeControl
Table
Implements
IContainer
IList<ControlBase>
ICollection<ControlBase>
IEnumerable<ControlBase>
IEnumerable
Inherited Members
CompositeControl.MouseLastHandledByChild
CompositeControl.Controls
CompositeControl.NamedControls
CompositeControl.CreateChildControls()
CompositeControl.IsDirtyEventHandler(bool)
CompositeControl.ProcessMouse(MouseScreenObjectState)
CompositeControl.AddControl(ControlBase)
CompositeControl.RemoveControl(ControlBase)
CompositeControl.Count
CompositeControl.this[int]
ControlBase.MouseState_IsMouseOver
ControlBase.MouseState_EnteredWithButtonDown
ControlBase.MouseState_IsMouseLeftDown
ControlBase.MouseState_IsMouseRightDown
ControlBase.OnUnfocused()
ControlBase.OnFocused()
ControlBase.OnIsDirtyChanged()
ControlBase.ProcessKeyboard(Keyboard)
ControlBase.LostMouse(MouseScreenObjectState)
ControlBase.OnParentChanged()
ControlBase.OnPositionChanged()
ControlBase.PlaceRelativeTo(ControlBase, Direction.Types, int)
ControlBase.DetermineState()
ControlBase.OnStateChanged(ControlStates, ControlStates)
ControlBase.OnSurfaceChanged(ICellSurface, ICellSurface)
ControlBase.FindThemeFont()
ControlBase.FindThemeColors()
ControlBase.SetThemeColors(Colors)
ControlBase.HasThemeColors()
ControlBase.Resize(int, int)
ControlBase.OnResized()
ControlBase.CreateControlSurface()
ControlBase.RefreshThemeStateColors(Colors)
ControlBase.OnMouseEnter(ControlBase.ControlMouseState)
ControlBase.ThemeState
ControlBase.UseKeyboard
ControlBase.CanFocus
ControlBase.CanResize
ControlBase.AlternateFont
ControlBase.Surface
ControlBase.MouseArea
ControlBase.IsMouseButtonStateClean
ControlBase.Position
ControlBase.AbsolutePosition
ControlBase.IsVisible
ControlBase.Tag
ControlBase.TabStop
ControlBase.TabIndex
ControlBase.IsDirty
ControlBase.Name
ControlBase.FocusOnMouseClick
ControlBase.Width
ControlBase.Height
ControlBase.IsFocused
ControlBase.IsEnabled
ControlBase.Bounds
ControlBase.Parent
ControlBase.State
ControlBase.IsDirtyChanged
ControlBase.Focused
ControlBase.Unfocused
ControlBase.PositionChanged
ControlBase.MouseEnter
ControlBase.MouseExit
ControlBase.MouseMove
ControlBase.MouseButtonClicked
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.Extended.dll
Syntax
public class Table : CompositeControl, IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable

Constructors

Table(int, int)

Creates a new table with the default SadConsole colors, and cell size of (1 width, 1 height)

Declaration
public Table(int width, int height)
Parameters
Type Name Description
int width
int height

Table(int, int, int, Color, Color, int)

Creates a new table with extra params to set the base default values of the table

Declaration
public Table(int width, int height, int cellWidth, Color defaultForeground, Color defaultBackground, int cellHeight = 1)
Parameters
Type Name Description
int width
int height
int cellWidth
Color defaultForeground
Color defaultBackground
int cellHeight

Table(int, int, int, int)

Creates a new table with custom cell width and cell height params; Uses the default SadConsole colors

Declaration
public Table(int width, int height, int cellWidth, int cellHeight = 1)
Parameters
Type Name Description
int width
int height
int cellWidth
int cellHeight

Properties

AutoScrollOnCellSelection

By default the table will automatically scroll to the selected cell if possible.

Declaration
public bool AutoScrollOnCellSelection { get; set; }
Property Value
Type Description
bool

Cells

The cells collection used to modify the table cells

Declaration
public Table.TableCells Cells { get; }
Property Value
Type Description
Table.TableCells

CurrentMouseCell

Returns the cell the mouse is over, if UseMouse is true.

Declaration
public Table.Cell? CurrentMouseCell { get; }
Property Value
Type Description
Table.Cell

DefaultBackground

The default background color used for the table background and newly created cells

Declaration
public Color DefaultBackground { get; set; }
Property Value
Type Description
Color

DefaultCellSize

The default size a cell gets when it is newly created

Declaration
public Point DefaultCellSize { get; set; }
Property Value
Type Description
Point

DefaultForeground

The default foreground color used for the table foreground and newly created cells

Declaration
public Color DefaultForeground { get; set; }
Property Value
Type Description
Color

DefaultHoverMode

The default visual hovering mode when hovering over cells

Declaration
public Table.TableCells.Layout.Mode DefaultHoverMode { get; set; }
Property Value
Type Description
Table.TableCells.Layout.Mode

DefaultSelectionMode

The default visual selection mode when selecting a cell

Declaration
public Table.TableCells.Layout.Mode DefaultSelectionMode { get; set; }
Property Value
Type Description
Table.TableCells.Layout.Mode

DrawFakeCells

By default, only cells that have been modified in anyway will be rendered on the table control. Turn this off, if the whole table should draw as many cells as it fits with their default layout.

Declaration
public bool DrawFakeCells { get; set; }
Property Value
Type Description
bool

HorizontalScrollBar

The horizontal scrollbar, use the SetupScrollBar method with Horizontal orientation to initialize it.

Declaration
public ScrollBar? HorizontalScrollBar { get; }
Property Value
Type Description
ScrollBar

HorizontalScrollBarMaximum

The updated maximum value, incase the scrollbar object's maximum value is not yet updated by the theme.

Declaration
public int HorizontalScrollBarMaximum { get; }
Property Value
Type Description
int

IsHorizontalScrollBarVisible

Returns true if the horizontal scroll bar is currently visible.

Declaration
public bool IsHorizontalScrollBarVisible { get; }
Property Value
Type Description
bool

IsVerticalScrollBarVisible

Returns true if the vertical scroll bar is currently visible.

Declaration
public bool IsVerticalScrollBarVisible { get; }
Property Value
Type Description
bool

SelectedCell

Returns the current selected cell

Declaration
public Table.Cell? SelectedCell { get; }
Property Value
Type Description
Table.Cell

UseMouse

When true, this object will use the mouse; otherwise false.

Declaration
public bool UseMouse { get; set; }
Property Value
Type Description
bool

VerticalScrollBar

The vertical scrollbar, use the SetupScrollBar method with Vertical orientation to initialize it.

Declaration
public ScrollBar? VerticalScrollBar { get; }
Property Value
Type Description
ScrollBar

VerticalScrollBarMaximum

The updated maximum value, incase the scrollbar object's maximum value is not yet updated by the theme.

Declaration
public int VerticalScrollBarMaximum { get; }
Property Value
Type Description
int

Methods

AdjustControlSurface(Cell, ColoredGlyphBase?, bool)

Declaration
protected void AdjustControlSurface(Table.Cell cell, ColoredGlyphBase? customStateAppearance, bool adjustVisibility)
Parameters
Type Name Description
Table.Cell cell
ColoredGlyphBase customStateAppearance
bool adjustVisibility

GetCustomStateAppearance(Cell)

Declaration
protected ColoredGlyphBase? GetCustomStateAppearance(Table.Cell cell)
Parameters
Type Name Description
Table.Cell cell
Returns
Type Description
ColoredGlyphBase

GetHorizontalAlignment(HorizontalAlign, int, char[])

Declaration
protected static int GetHorizontalAlignment(Table.Cell.Options.HorizontalAlign hAlign, int totalWidth, char[] textArr)
Parameters
Type Name Description
Table.Cell.Options.HorizontalAlign hAlign
int totalWidth
char[] textArr
Returns
Type Description
int

GetOldRowAndColumnValues(List<((int x, int y), (int row, int col))>?, Point, ref int, ref int)

Declaration
protected void GetOldRowAndColumnValues(List<((int x, int y), (int row, int col))>? fakeCells, Point cellPosition, ref int oldRow, ref int oldCol)
Parameters
Type Name Description
List<((int x, int y), (int row, int col))> fakeCells
Point cellPosition
int oldRow
int oldCol

GetTotalCellSize(Cell, int, int, out int, out int)

Declaration
protected static void GetTotalCellSize(Table.Cell cell, int width, int height, out int totalWidth, out int totalHeight)
Parameters
Type Name Description
Table.Cell cell
int width
int height
int totalWidth
int totalHeight

HideVisualCell(int, int, Point)

Declaration
protected void HideVisualCell(int column, int row, Point position)
Parameters
Type Name Description
int column
int row
Point position

OnLeftMouseClicked(ControlMouseState)

Called when the left mouse button is clicked. Raises the MouseButtonClicked event and calls the DetermineState() method.

Declaration
protected override void OnLeftMouseClicked(ControlBase.ControlMouseState state)
Parameters
Type Name Description
ControlBase.ControlMouseState state

The current mouse data

Overrides
ControlBase.OnLeftMouseClicked(ControlBase.ControlMouseState)

OnMouseExit(ControlMouseState)

Called when the mouse exits the area of the control. Raises the MouseExit event and calls the DetermineState() method.

Declaration
protected override void OnMouseExit(ControlBase.ControlMouseState state)
Parameters
Type Name Description
ControlBase.ControlMouseState state

The current mouse data

Overrides
ControlBase.OnMouseExit(ControlBase.ControlMouseState)

OnMouseIn(ControlMouseState)

Called as the mouse moves around the control area. Raises the MouseMove event and calls the DetermineState() method.

Declaration
protected override void OnMouseIn(ControlBase.ControlMouseState state)
Parameters
Type Name Description
ControlBase.ControlMouseState state

The current mouse data

Overrides
ControlBase.OnMouseIn(ControlBase.ControlMouseState)

OnRightMouseClicked(ControlMouseState)

Called when the right mouse button is clicked. Raises the MouseButtonClicked event and calls the DetermineState() method.

Declaration
protected override void OnRightMouseClicked(ControlBase.ControlMouseState state)
Parameters
Type Name Description
ControlBase.ControlMouseState state

The current mouse data.

Overrides
ControlBase.OnRightMouseClicked(ControlBase.ControlMouseState)

PrintText(Cell)

Declaration
protected void PrintText(Table.Cell cell)
Parameters
Type Name Description
Table.Cell cell

ScrollToSelectedItem()

Scrolls the list to the item currently selected.

Declaration
public void ScrollToSelectedItem()

SetScrollBarVisibility(int, int)

Declaration
protected void SetScrollBarVisibility(int maxRowsHeight, int maxColumnsWidth)
Parameters
Type Name Description
int maxRowsHeight
int maxColumnsWidth

SetupScrollBar(Orientation, int, Point)

Configures the associated VerticalScrollBar.

Declaration
public void SetupScrollBar(Orientation orientation, int size, Point position)
Parameters
Type Name Description
Orientation orientation

The orientation of the scrollbar.

int size
Point position

The position of the scrollbar.

UpdateAndRedraw(TimeSpan)

Updates each control hosted by this control.

Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type Name Description
TimeSpan time

The game frame time delta.

Overrides
CompositeControl.UpdateAndRedraw(TimeSpan)

Events

OnCellDoubleClick

Fires an event when a cell is double clicked.

Declaration
public event EventHandler<Table.CellEventArgs>? OnCellDoubleClick
Event Type
Type Description
EventHandler<Table.CellEventArgs>

OnCellEnter

Fires an event when a cell is entered by the mouse.

Declaration
public event EventHandler<Table.CellEventArgs>? OnCellEnter
Event Type
Type Description
EventHandler<Table.CellEventArgs>

OnCellExit

Fires an event when a cell is exited by the mouse.

Declaration
public event EventHandler<Table.CellEventArgs>? OnCellExit
Event Type
Type Description
EventHandler<Table.CellEventArgs>

OnCellLeftClick

Fires an event when a cell is left clicked.

Declaration
public event EventHandler<Table.CellEventArgs>? OnCellLeftClick
Event Type
Type Description
EventHandler<Table.CellEventArgs>

OnCellRightClick

Fires an event when a cell is right clicked.

Declaration
public event EventHandler<Table.CellEventArgs>? OnCellRightClick
Event Type
Type Description
EventHandler<Table.CellEventArgs>

OnDrawFakeCell

Called when a fake cells is being drawn, you can use this to modify the cell layout.

Declaration
public event EventHandler<Table.CellEventArgs>? OnDrawFakeCell
Event Type
Type Description
EventHandler<Table.CellEventArgs>

SelectedCellChanged

Fires an event when the selected cell has changed.

Declaration
public event EventHandler<Table.CellChangedEventArgs>? SelectedCellChanged
Event Type
Type Description
EventHandler<Table.CellChangedEventArgs>

Implements

IContainer
IList<T>
ICollection<T>
IEnumerable<T>
IEnumerable

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX