Search Results for

Show / Hide Table of Contents

# Class ScrollBarView

ScrollBarViews are views that display a 1-character scrollbar, either horizontal or vertical

##### Inheritance

System.Object
Responder
View
ScrollBarView

##### Implements

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

##### Remarks

The scrollbar is drawn to be a representation of the Size, assuming that the scroll position is set at Position.

If the region to display the scrollbar is larger than three characters, arrow indicators are drawn.

##### Inherited Members

View.GetMinWidthHeight(Size)
View.SetMinWidthHeight()
View.UpdateTextFormatterText()
View.ProcessResizeView()
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.OnAdded(View)
View.OnRemoved(View)
View.OnLeave(View)
View.AddRune(Int32, Int32, Rune)
View.ClearNeedsDisplay()
View.OnDrawContent(Rect)
View.OnDrawContentComplete(Rect)
View.SetFocus()
View.ProcessKey(KeyEvent)
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.OnKeyDown(KeyEvent)
View.OnKeyUp(KeyEvent)
View.EnsureFocus()
View.FocusFirst()
View.FocusLast()
View.FocusPrev()
View.FocusNext()
View.LayoutSubviews()
View.ToString()
View.GetAutoSize()
View.GetHotKeySpecifierLength(Boolean)
View.GetTextFormatterBoundsSize()
View.GetBoundsTextFormatterSize()
View.OnMouseEnter(MouseEvent)
View.OnMouseLeave(MouseEvent)
View.OnMouseEvent(MouseEvent)
View.OnMouseClick(View.MouseEventArgs)
View.OnCanFocusChanged()
View.OnEnabledChanged()
View.OnVisibleChanged()
View.Dispose(Boolean)
View.BeginInit()
View.EndInit()
View.SetWidth(Int32, Int32)
View.SetHeight(Int32, Int32)
View.GetCurrentWidth(Int32)
View.GetCurrentHeight(Int32)
View.GetNormalColor()
View.GetTopSuperView()
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.ForceValidatePosDim
View.TextFormatter
View.SuperView
View.HasFocus
View.Focused
View.MostFocused
View.ColorScheme
View.Text
View.AutoSize
View.PreserveTrailingSpaces
View.TextAlignment
View.VerticalTextAlignment
View.TextDirection
View.IsInitialized
View.IsAdded
View.Enabled
View.Visible
View.Border
View.Added
View.Removed
View.Enter
View.Leave
View.MouseEnter
View.MouseLeave
View.MouseClick
View.CanFocusChanged
View.EnabledChanged
View.VisibleChanged
View.HotKeyChanged
View.DrawContent
View.DrawContentComplete
View.KeyPress
View.KeyDown
View.KeyUp
View.LayoutStarted
View.LayoutComplete
View.Initialized
Responder.Dispose()

###### Namespace: Terminal.Gui

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

##### Syntax

    public class ScrollBarView : View

### Constructors

#### ScrollBarView()

Initializes a new instance of the ScrollBarView class using Computed layout.

##### Declaration

    public ScrollBarView()

#### ScrollBarView(Int32, Int32, Boolean)

Initializes a new instance of the ScrollBarView class using Computed layout.

##### Declaration

    public ScrollBarView(int size, int position, bool isVertical)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | size | The size that this scrollbar represents.
System.Int32 | position | The position within this scrollbar.
System.Boolean | isVertical | If set to `true` this is a vertical scrollbar, otherwise, the scrollbar is horizontal.

#### ScrollBarView(Rect)

Initializes a new instance of the ScrollBarView class using Absolute layout.

##### Declaration

    public ScrollBarView(Rect rect)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | rect | Frame for the scrollbar.

#### ScrollBarView(Rect, Int32, Int32, Boolean)

Initializes a new instance of the ScrollBarView class using Absolute layout.

##### Declaration

    public ScrollBarView(Rect rect, int size, int position, bool isVertical)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | rect | Frame for the scrollbar.
System.Int32 | size | The size that this scrollbar represents. Sets the Size property.
System.Int32 | position | The position within this scrollbar. Sets the Position property.
System.Boolean | isVertical | If set to `true` this is a vertical scrollbar, otherwise, the scrollbar is horizontal. Sets the IsVertical property.

#### ScrollBarView(View, Boolean, Boolean)

Initializes a new instance of the ScrollBarView class using Computed layout.

##### Declaration

    public ScrollBarView(View host, bool isVertical, bool showBothScrollIndicator = true)

##### Parameters

Type | Name | Description
--- | --- | ---
View | host | The view that will host this scrollbar.
System.Boolean | isVertical | If set to `true` this is a vertical scrollbar, otherwise, the scrollbar is horizontal.
System.Boolean | showBothScrollIndicator | If set to `true (default)` will have the other scrollbar, otherwise will have only one.

### Properties

#### AutoHideScrollBars

If true the vertical/horizontal scroll bars won't be showed if it's not needed.

##### Declaration

    public bool AutoHideScrollBars { get; set; }

##### Property Value

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

#### Host

Get or sets the view that host this View

##### Declaration

    public View Host { get; }

##### Property Value

Type | Description
--- | ---
View |

#### IsVertical

If set to `true` this is a vertical scrollbar, otherwise, the scrollbar is horizontal.

##### Declaration

    public bool IsVertical { get; set; }

##### Property Value

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

#### KeepContentAlwaysInViewport

Get or sets if the view-port is kept always visible in the area of this ScrollBarView

##### Declaration

    public bool KeepContentAlwaysInViewport { get; set; }

##### Property Value

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

#### OtherScrollBarView

Represent a vertical or horizontal ScrollBarView other than this.

##### Declaration

    public ScrollBarView OtherScrollBarView { get; set; }

##### Property Value

Type | Description
--- | ---
ScrollBarView |

#### Position

The position, relative to Size, to set the scrollbar at.

##### Declaration

    public int Position { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 | The position.

#### ShowScrollIndicator

Gets or sets the visibility for the vertical or horizontal scroll indicator.

##### Declaration

    public bool ShowScrollIndicator { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if show vertical or horizontal scroll indicator; otherwise, `false`.

#### Size

The size of content the scrollbar represents.

##### Declaration

    public int Size { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int32 | The size.

### Methods

#### MouseEvent(MouseEvent)

Method invoked when a mouse event is generated

##### Declaration

    public override bool MouseEvent(MouseEvent me)

##### Parameters

Type | Name | Description
--- | --- | ---
MouseEvent | me |

##### Returns

Type | Description
--- | ---
System.Boolean | `true`, if the event was handled, `false` otherwise.

##### Overrides

Responder.MouseEvent(MouseEvent)

#### OnChangedPosition()

Virtual method to invoke the ChangedPosition action event.

##### Declaration

    public virtual void OnChangedPosition()

#### OnEnter(View)

Method invoked when a view gets focus.

##### Declaration

    public override bool OnEnter(View view)

##### Parameters

Type | Name | Description
--- | --- | ---
View | view | The view that is losing focus.

##### Returns

Type | Description
--- | ---
System.Boolean | `true`, if the event was handled, `false` otherwise.

##### Overrides

View.OnEnter(View)

#### Redraw(Rect)

Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.

##### Declaration

    public override void Redraw(Rect region)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | region |

##### Overrides

View.Redraw(Rect)

#### Refresh()

Only used for a hosted view that will update and redraw the scrollbars.

##### Declaration

    public virtual void Refresh()

### Events

#### ChangedPosition

This event is raised when the position on the scrollbar has changed.

##### Declaration

    public event Action ChangedPosition

##### Event Type

Type | Description
--- | ---
System.Action |

### Implements

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