diff --git a/docfx/docs/migratingfromv1.md b/docfx/docs/migratingfromv1.md index 2239bd7ff..e9810ddc7 100644 --- a/docfx/docs/migratingfromv1.md +++ b/docfx/docs/migratingfromv1.md @@ -152,12 +152,15 @@ In v2, the `Border`, `Margin`, and `Padding` properties have been added to all v In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base @Terminal.Gui.View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content is described by @Terminal.Gui.View.GetContentSize. See [Layout](layout.md) for details. +@Terminal.Gui.ScrollBar replaces `ScrollBarView` with a much cleaner implementation of a scrollbar. In addition, @Terminal.Gui.View.VerticalScrollBar and @Terminal.Gui.View.HorizontalScrollBar provide a simple way to enable scroll bars in any View with almost no code. See See [Scrolling Deep Dive](scrolling.md) for more. + ### How to Fix * Replace `ScrollView` with @Terminal.Gui.View and use `Viewport` and @Terminal.Gui.View.GetContentSize to control scrolling. * Update any code that assumed `Bounds.Location` was always `Point.Empty`. * Update any code that used `Bounds` to refer to the size of the view's content. Use @Terminal.Gui.View.GetContentSize instead. * Update any code that assumed `Bounds.Size` was the same as `Frame.Size`. `Frame.Size` defines the size of the view in the superview's coordinate system, while `Viewport.Size` defines the visible area of the view in its own coordinate system. +* Replace `ScrollBarView` with @Terminal.Gui.ScrollBar. See [Scrolling Deep Dive](scrolling.md) for more. ## Updated Keyboard API diff --git a/docfx/docs/newinv2.md b/docfx/docs/newinv2.md index 4b6c8cf74..e9d2c4e6e 100644 --- a/docfx/docs/newinv2.md +++ b/docfx/docs/newinv2.md @@ -21,7 +21,8 @@ The entire library has been reviewed and simplified. As a result, the API is mor ## [View](~/api/Terminal.Gui.View.yml) Improvements * *Improved!* View Lifetime Management is Now Deterministic - In v1 the rules for lifetime management of `View` objects was unclear and led to non-dterministic behavior and hard to diagnose bugs. This was particularly acute in the behavior of `Application.Run`. In v2, the rules are clear and the code and unit test infrastructure tries to enforce them. See [Migrating From v1 To v2](migratingfromv1.md) for more details. * *New!* Adornments - Adornments are a special form of View that appear outside the `Viewport`: @Terminal.Gui.View.Margin, @Terminal.Gui.View.Border, and @Terminal.Gui.View.Padding. -* *New!* Built-in Scrolling/Virtual Content Area - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a protal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.GetContentSize()`. See [Layout](layout.md) for details. +* *New!* Built-in Scrolling/Virtual Content Area - In v1, to have a view a user could scroll required either a bespoke scrolling implementation, inheriting from `ScrollView`, or managing the complexity of `ScrollBarView` directly. In v2, the base-View class supports scrolling inherently. The area of a view visible to the user at a given moment was previously a rectangle called `Bounds`. `Bounds.Location` was always `Point.Empty`. In v2 the visible area is a rectangle called `Viewport` which is a portal into the Views content, which can be bigger (or smaller) than the area visible to the user. Causing a view to scroll is as simple as changing `View.Viewport.Location`. The View's content described by `View.GetContentSize()`. See [Layout](layout.md) for details. +* *Improved!* @Terminal.Gui.ScrollBar replaces `ScrollBarView` with a much cleaner implementation of a scrollbar. In addition, @Terminal.Gui.View.VerticalScrollBar and @Terminal.Gui.View.HorizontalScrollBar provide a simple way to enable scroll bars in any View with almost no code. See See [Scrolling Deep Dive](scrolling.md) for more. * *New!* @Terminal.Gui.DimAuto - Automatically sizes the view to fit the view's Text, SubViews, or ContentArea. * *Improved!* @Terminal.Gui.PosAnchorEnd - New to v2 is `Pos.AnchorEnd ()` (with no parameters) which allows a view to be anchored to the right or bottom of the SuperView. * *New!* @Terminal.Gui.PosAlign - Aligns a set of views horizontally or vertically (left, right, center, etc...). diff --git a/docfx/docs/scrolling.md b/docfx/docs/scrolling.md index 7e7fea84c..41e22b90e 100644 --- a/docfx/docs/scrolling.md +++ b/docfx/docs/scrolling.md @@ -36,7 +36,7 @@ These Scenarios illustrate Terminal.Gui scrolling: * *ScrollBar Demo* - Demonstrates using @Terminal.Gui.ScrollBar view in a standalone manner. * *ViewportSettings* - 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. -* *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. +* *ListView* and *HexEdit* - 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)