mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Scenario cleanup. scrolling.md
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
* *Parent View* - A view that holds a reference to another view in a parent/child relationship, but is NOT a SuperView of the child. Terminal.Gui uses the terms "Child" and "Parent" sparingly. Generally Subview/SuperView is preferred.
|
||||
|
||||
### Layout
|
||||
### Layout and Arrangement
|
||||
|
||||
See the [Layout Deep Dive](layout.md) and the [Arrangement Deep Dive](arrangement.md).
|
||||
|
||||
@@ -26,6 +26,11 @@ See the [Drawing Deep Dive](drawing.md).
|
||||
|
||||
See the [Navigation Deep Dive](navigation.md).
|
||||
|
||||
### Scrolling
|
||||
|
||||
See the [Scrolling Deep Dive](scrolling.md).
|
||||
|
||||
|
||||
### Application Concepts
|
||||
|
||||
* *TopLevel* - The v1 term used to describe a view that can have a MenuBar and/or StatusBar. In v2, we will delete the `TopLevel` class and ensure ANY View can have a menu bar and/or status bar (via `Adornments`).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Terminal.Gui provides a rich system for how [View](View.md) objects are laid out relative to each other. The layout system also defines how coordinates are specified.
|
||||
|
||||
See [View Deep Dive](View.md) and [Arrangement Deep Dive](arrangement.md) for more.
|
||||
See [View Deep Dive](View.md), [Arrangement Deep Dive](arrangement.md), [Scrolling Deep Dive](scrolling.md), and [Drawing Deep Dive](drawing.md) for more.
|
||||
|
||||
## Lexicon & Taxonomy
|
||||
|
||||
@@ -80,11 +80,12 @@ The Viewport (@Terminal.Gui.View.Viewport) is a rectangle describing the portion
|
||||
|
||||
To enable scrolling call `View.SetContentSize()` and then set `Viewport.Location` to positive values. Making `Viewport.Location` positive moves the Viewport down and to the right in the content.
|
||||
|
||||
See the [Scrolling Deep Dive](scrolling.md) for details on how to enable scrolling.
|
||||
|
||||
The `View.ViewportSettings` property controls how the Viewport is constrained. By default, the `ViewportSettings` is set to `ViewportSettings.None`. To enable the viewport to be moved up-and-to-the-left of the content, use `ViewportSettings.AllowNegativeX` and or `ViewportSettings.AllowNegativeY`.
|
||||
|
||||
The default `ViewportSettings` also constrains the Viewport to the size of the content, ensuring the right-most column or bottom-most row of the content will always be visible (in v1 the equivalent concept was `ScrollBarView.AlwaysKeepContentInViewport`). To allow the Viewport to be smaller than the content, set `ViewportSettings.AllowXGreaterThanContentWidth` and/or `ViewportSettings.AllowXGreaterThanContentHeight`.
|
||||
|
||||
|
||||
* *@Terminal.Gui.View.GetContentSize()* - The content area is the area where the view's content is drawn. Content can be any combination of the @Terminal.Gui.View.Text property, `Subviews`, and other content drawn by the View. The @Terminal.Gui.View.GetContentSize method gets the size of the content area of the view. *Content Area* refers to the rectangle with a location of `0,0` with the size returned by @Terminal.Gui.View.GetContentSize. The [Layout Deep Dive](layout.md) has more details on the Content Area.
|
||||
|
||||
* *@Terminal.Gui.View.Viewport* A rectangle describing the portion of the *Content Area* that is currently visible to the user. It is a "portal" into the content. The `Viewport.Location` is relative to the top-left corner of the inner rectangle of `View.Padding`. If `Viewport.Size` is the same as `View.GetContentSize()`, `Viewport.Location` will be `0,0`.
|
||||
|
||||
@@ -7,10 +7,9 @@ Terminal.Gui provides a rich system for how [View](View.md) users can scroll con
|
||||
See [View Deep Dive](View.md) for broader definitions.
|
||||
|
||||
* *Scroll* (Verb) - The act of causing content to move either horizontally or vertically within the [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml). Also referred to as "Content Scrolling".
|
||||
* *[Scroll](~/api/Terminal.Gui.Scroll.yml)* (Noun) - Indicates the size of scrollable content and provides a visible element, referred to as the "ScrollSlider" that that is sized to show the proportion of the scrollable content to the size of the [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml) and can be dragged with the mouse. A Scroll can be oriented either vertically or horizontally and is used within a [ScrollBar](~/api/Terminal.Gui.ScrollBar.yml).
|
||||
* *ScrollSlider* - The visual indicator that shows the proportion of the scrollable content to the size of the [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml) and allows the user to use the mouse to scroll. The Scroll Slider is not exposed publicly.
|
||||
* *[ScrollBar](~/api/Terminal.Gui.ScrollBar.yml)* - Provides a visual indicator that content can be scrolled. ScrollBars consist of two buttons, one each for scrolling forward or backwards, a Scroll that can be clicked to scroll large amounts, and a ScrollSlider that can be dragged to scroll continuously. ScrollBars can be oriented either horizontally or vertically and support the user dragging and clicking with the mouse to scroll.
|
||||
|
||||
* *ScrollSlider* - A visual indicator that shows the proportion of the scrollable content to the size of the [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml) and allows the user to use the mouse to scroll.
|
||||
* *[ScrollBar](~/api/Terminal.Gui.ScrollBar.yml)* - Indicates the size of scrollable content and controls the position of the visible content, either vertically or horizontally. At each end, a @Terminal.Gui.Button is provided, one to scroll up or left and one to scroll down or right. Between the
|
||||
buttons is a @Terminal.Gui.ScrollSlider that can be dragged to control the position of the visible content. The ScrollSlier is sized to show the proportion of the scrollable content to the size of the @Terminal.Gui.View.Viewport.
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -25,17 +24,16 @@ Scrolling with the mouse and keyboard are enabled by:
|
||||
1) Making the [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml) size smaller than the size returned by [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml).
|
||||
2) Creating key bindings for the appropriate directional keys (e.g. [Key.CursorDown](~/api/Terminal.Gui.Key)), and calling [View.ScrollHorizontal()](~/api/Terminal.Gui.View.ScrollHorizontal.yml)/[ScrollVertical()](~/api/Terminal.Gui.View.ScrollVertical.yml) as needed.
|
||||
3) Subscribing to [View.MouseEvent](~/api/Terminal.Gui.View.MouseEvent.yml) and calling calling [View.ScrollHorizontal()](~/api/Terminal.Gui.View.ScrollHorizontal.yml)/[ScrollVertical()](~/api/Terminal.Gui.View.ScrollVertical.yml) as needed.
|
||||
4) Enabling the [ScrollBar](~/api/Terminal.Gui.ScrollBar.yml)s built into View ([View.HorizontalScrollBar/VerticalScrollBar](~/api/Terminal.Gui.View.HorizontalScrollBar.yml)) by setting the flag [ViewportSettings.EnableScrollBars](~/api/Terminal.Gui.ViewportSettings.EnableScrollBars.yml) on [View.ViewportSettings](~/api/Terminal.Gui.View.ViewportSettings.yml).
|
||||
4) Enabling the [ScrollBar](~/api/Terminal.Gui.ScrollBar.yml)s built into View ([View.HorizontalScrollBar/VerticalScrollBar](~/api/Terminal.Gui.View.HorizontalScrollBar.yml)) by either enabling automatic show/hide behavior (@Terminal.Gui.ScrollBar.AutoShow) or explicitly making them visible (@Terminal.Gui.View.Visible).
|
||||
|
||||
## Examples
|
||||
|
||||
These Scenarios illustrate Terminal.Gui scrolling:
|
||||
|
||||
* *Scrolling* - Demonstrates the @Terminal.Gui.ScrollBar objects built into-View.
|
||||
* *ScrollBar Demo* - Demonstrates using @Terminal.Gui.ScrollBar view in a standalone manner.
|
||||
* *Content Scrolling* - Demonstrates the various [Viewport Settings](~/api/Terminal.Gui.ViewportSettings.yml) (see below) in an interactive manner. Used by the development team to visually verify that convoluted View layout and arrangement scenarios scroll properly.
|
||||
* *Character Map* - Demonstrates a sophisticated scrolling use-case. The entire set of Unicode code-points can be scrolled and searched. From a scrolling perspective, this Scenario illustrates how to manually configure `Viewport`, `SetContentArea()`, and `ViewportSettings` to enable horizontal and vertical headers (as might appear in a spreadsheet), full keyboard and mouse support, and more.
|
||||
* *Scroll Demo* - Designed to demonstrate using the `Scroll` view in a standalone manner.
|
||||
* *ScrollBar Demo* - Designed to demonstrate using the `ScrollBar` view in a standalone manner.
|
||||
* *Scrolling* - A legacy Scenario from v1 that is used to visually test that scrolling is working properly.
|
||||
* *ListView* and *TableView* - The source code to these built-in Views are good references for how to support scrolling and ScrollBars in a re-usable View sub-class.
|
||||
|
||||
## [Viewport Settings](~/api/Terminal.Gui.ViewportSettings.yml)
|
||||
|
||||
Reference in New Issue
Block a user