|
@@ -6,7 +6,7 @@ For detailed breaking change documentation check out this Discussion: https://gi
|
|
|
|
|
|
## View Constructors -> Initializers
|
|
## View Constructors -> Initializers
|
|
|
|
|
|
-In v1, [View](~/api/Terminal.Gui.View.yml) and most sub-classes had multiple constructors that took a variety of parameters. In v2, the constructors have been replaced with initializers. This change was made to simplify the API and make it easier to use. In addition, the v1 constructors drove a false (and needlessly complex) distinction between "Absolute" and "Computed" layout. In v2, the layout system is much simpler and more intuitive.
|
|
|
|
|
|
+In v1, @Terminal.Gui.View and most sub-classes had multiple constructors that took a variety of parameters. In v2, the constructors have been replaced with initializers. This change was made to simplify the API and make it easier to use. In addition, the v1 constructors drove a false (and needlessly complex) distinction between "Absolute" and "Computed" layout. In v2, the layout system is much simpler and more intuitive.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -21,7 +21,7 @@ Replace the constructor calls with initializer calls.
|
|
|
|
|
|
Terminal.Gui v2 now supports 24-bit color by default. This means that the colors you use in your application will be more accurate and vibrant. If you are using custom colors in your application, you may need to update them to use the new 24-bit color format.
|
|
Terminal.Gui v2 now supports 24-bit color by default. This means that the colors you use in your application will be more accurate and vibrant. If you are using custom colors in your application, you may need to update them to use the new 24-bit color format.
|
|
|
|
|
|
-The [Attribute](~/api/Terminal.Gui.Attribute.yml) class has been simplified. Color names now match the ANSI standard ('Brown' is now called 'Yellow')
|
|
|
|
|
|
+The @Terminal.Gui.Attribute class has been simplified. Color names now match the ANSI standard ('Brown' is now called 'Yellow')
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -83,23 +83,23 @@ When measuring the screen space taken up by a `string` you can use the extension
|
|
|
|
|
|
## `View Life Cycle Management
|
|
## `View Life Cycle Management
|
|
|
|
|
|
-In v1, [View](~/api/Terminal.Gui.View.yml) was derived from `Responder` which supported `IDisposable`. In v2, `Responder` has been removed and [View](~/api/Terminal.Gui.View.yml) is the base-class supporting `IDisposable`.
|
|
|
|
|
|
+In v1, @Terminal.Gui.View was derived from `Responder` which supported `IDisposable`. In v2, `Responder` has been removed and @Terminal.Gui.View is the base-class supporting `IDisposable`.
|
|
|
|
|
|
-In v1, [Application.Init](~/api/Terminal.Gui./Terminal.Gui.Application.Init) automatically created a toplevel view and set [Application.Top](~/api/Terminal.Gui.Application.Top.yml). In v2, [Application.Init](~/api/Terminal.Gui.Application.Init.yml) no longer automatically creates a toplevel or sets [Application.Top](~/api/Terminal.Gui.Application.Top.yml); app developers must explicitly create the toplevel view and pass it to [Application.Run](~/api/Terminal.Gui.Application.Run.yml) (or use `Application.Run<myTopLevel>`). Developers are responsible for calling `Dispose` on any toplevel they create before exiting.
|
|
|
|
|
|
+In v1, @Terminal.Gui./Terminal.Gui.Application.Init) automatically created a toplevel view and set [Application.Top](~/api/Terminal.Gui.Application.Top. In v2, @Terminal.Gui.Application.Init no longer automatically creates a toplevel or sets @Terminal.Gui.Application.Top; app developers must explicitly create the toplevel view and pass it to @Terminal.Gui.Application.Run (or use `Application.Run<myTopLevel>`). Developers are responsible for calling `Dispose` on any toplevel they create before exiting.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
-* Replace `Responder` with [View](~/api/Terminal.Gui.View.yml)
|
|
|
|
|
|
+* Replace `Responder` with @Terminal.Gui.View
|
|
* Update any code that assumes `Application.Init` automatically created a toplevel view and set `Application.Top`.
|
|
* Update any code that assumes `Application.Init` automatically created a toplevel view and set `Application.Top`.
|
|
* Update any code that assumes `Application.Init` automatically disposed of the toplevel view when the application exited.
|
|
* Update any code that assumes `Application.Init` automatically disposed of the toplevel view when the application exited.
|
|
|
|
|
|
-## [Pos](~/api/Terminal.Gui.Pos.yml) and [Dim](~/api/Terminal.Gui.Dim.yml) types now adhere to standard C# idioms
|
|
|
|
|
|
+## @Terminal.Gui.Pos and @Terminal.Gui.Dim types now adhere to standard C# idioms
|
|
|
|
|
|
-* In v1, the [Pos](~/api/Terminal.Gui.Pos.yml) and [Dim](~/api/Terminal.Gui.Dim.yml) types (e.g. [Pos.PosView](~/api/Terminal.Gui.Pos.PosView.yml)) were nested classes and marked [internal](~/api/Terminal.Gui.internal.yml). In v2, they are no longer nested, and have appropriate public APIs.
|
|
|
|
|
|
+* In v1, the @Terminal.Gui.Pos and @Terminal.Gui.Dim types (e.g. @Terminal.Gui.Pos.PosView) were nested classes and marked @Terminal.Gui.internal. In v2, they are no longer nested, and have appropriate public APIs.
|
|
* Nullabilty is enabled.
|
|
* Nullabilty is enabled.
|
|
* Methods & properties follow standards.
|
|
* Methods & properties follow standards.
|
|
-* The static method that creates a [PosAbsolute](~/api/Terminal.Gui.PosAbsolute.yml), `Pos.At`, was renamed to [Pos.Absolute](~/api/Terminal.Gui.Pos.Absolute.yml) for consistency.
|
|
|
|
-* The static method that crates as [DimAbsoulte](~/api/Terminal.Gui.DimAbsoulte.yml), `Dim.Sized`, was renamed to [Dim.Absolute](~/api/Terminal.Gui.Dim.Absolute.yml) for consistency.
|
|
|
|
|
|
+* The static method that creates a @Terminal.Gui.PosAbsolute, `Pos.At`, was renamed to @Terminal.Gui.Pos.Absolute for consistency.
|
|
|
|
+* The static method that crates as @Terminal.Gui.DimAbsoulte, `Dim.Sized`, was renamed to @Terminal.Gui.Dim.Absolute for consistency.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -115,9 +115,9 @@ In v1, [Application.Init](~/api/Terminal.Gui./Terminal.Gui.Application.Init) aut
|
|
In v2, the layout system has been improved to make it easier to create complex user interfaces. If you are using custom layouts in your application, you may need to update them to use the new layout system.
|
|
In v2, the layout system has been improved to make it easier to create complex user interfaces. If you are using custom layouts in your application, you may need to update them to use the new layout system.
|
|
|
|
|
|
* The distinction between `Absolute Layout` and `Computed Layout` has been removed, as has the `LayoutStyle` enum. v1 drew a false distinction between these styles.
|
|
* The distinction between `Absolute Layout` and `Computed Layout` has been removed, as has the `LayoutStyle` enum. v1 drew a false distinction between these styles.
|
|
-* [View.Frame](~/api/Terminal.Gui.View.Frame.yml) now represents the position and size of the view in the superview's coordinate system. The `Frame` property is of type `Rectangle`.
|
|
|
|
-* [View.Bounds](~/api/Terminal.Gui.View.Bounds.yml) has been replaced by [View.Viewport](~/api/Terminal.Gui.View.Viewport.yml). The `Viewport` property represents the visible area of the view in its own coordinate system. The `Viewport` property is of type `Rectangle`.
|
|
|
|
-* [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) represents the size of the view's content. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
|
|
|
|
|
|
+* @Terminal.Gui.View.Frame now represents the position and size of the view in the superview's coordinate system. The `Frame` property is of type `Rectangle`.
|
|
|
|
+* @Terminal.Gui.View.Bounds has been replaced by @Terminal.Gui.View.Viewport. The `Viewport` property represents the visible area of the view in its own coordinate system. The `Viewport` property is of type `Rectangle`.
|
|
|
|
+* @Terminal.Gui.View.GetContentSize represents the size of the view's content. This replaces `ScrollView` and `ScrollBarView` in v1. See more below.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -128,13 +128,13 @@ In v2, the layout system has been improved to make it easier to create complex u
|
|
* Update any code that assumed `Bounds.Location` was always `Point.Empty`.
|
|
* 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 `GetContentSize()` instead.
|
|
* Update any code that used `Bounds` to refer to the size of the view's content. Use `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.
|
|
* 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.
|
|
-* Use [View.GetAdornmentsThickness](~/api/Terminal.Gui.View.GetAdornmentsThickness.yml) to get the total thickness of the view's border, margin, and padding.
|
|
|
|
|
|
+* Use @Terminal.Gui.View.GetAdornmentsThickness to get the total thickness of the view's border, margin, and padding.
|
|
* Not assume a View can draw outside of 'Viewport'. Use the 'Margin', 'Border', and 'Padding' Adornments to do things outside of `Viewport`. View subclasses should not implement their own concept of padding or margins but leverage these `Adornments` instead.
|
|
* Not assume a View can draw outside of 'Viewport'. Use the 'Margin', 'Border', and 'Padding' Adornments to do things outside of `Viewport`. View subclasses should not implement their own concept of padding or margins but leverage these `Adornments` instead.
|
|
* Mouse and draw events now provide coordinates relative to the `Viewport` not the `Frame`.
|
|
* Mouse and draw events now provide coordinates relative to the `Viewport` not the `Frame`.
|
|
|
|
|
|
-## `View.AutoSize` has been removed. Use [Dim.Auto](~/api/Terminal.Gui.Dim.Auto.yml) for width or height instead.
|
|
|
|
|
|
+## `View.AutoSize` has been removed. Use @Terminal.Gui.Dim.Auto for width or height instead.
|
|
|
|
|
|
-In v1, `View.AutoSize` was used to size a view to its `Text`. In v2, `View.AutoSize` has been removed. Use [Dim.Auto](~/api/Terminal.Gui.Dim.Auto.yml) for width or height instead.
|
|
|
|
|
|
+In v1, `View.AutoSize` was used to size a view to its `Text`. In v2, `View.AutoSize` has been removed. Use @Terminal.Gui.Dim.Auto for width or height instead.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -144,36 +144,36 @@ In v1, `View.AutoSize` was used to size a view to its `Text`. In v2, `View.AutoS
|
|
|
|
|
|
In v2, the `Border`, `Margin`, and `Padding` properties have been added to all views. This simplifies view development and enables a sophisticated look and feel. If you are using custom borders, margins, or padding in your application, you may need to update them to use the new properties.
|
|
In v2, the `Border`, `Margin`, and `Padding` properties have been added to all views. This simplifies view development and enables a sophisticated look and feel. If you are using custom borders, margins, or padding in your application, you may need to update them to use the new properties.
|
|
|
|
|
|
-* `View.Border` is now of type [Adornment](~/api/Terminal.Gui.Adornment.yml). [View.BorderStyle](~/api/Terminal.Gui.View.BorderStyle.yml) is provided as a convenience property to set the border style (`myView.BorderStyle = LineStyle.Double`).
|
|
|
|
|
|
+* `View.Border` is now of type @Terminal.Gui.Adornment. @Terminal.Gui.View.BorderStyle is provided as a convenience property to set the border style (`myView.BorderStyle = LineStyle.Double`).
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
## Built-in Scrolling
|
|
## Built-in Scrolling
|
|
|
|
|
|
-In v1, scrolling was enabled by using `ScrollView` or `ScrollBarView`. In v2, the base [View](~/api/Terminal.Gui.View.yml) 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 [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml). See [Layout](layout.md) for details.
|
|
|
|
|
|
+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.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
-* Replace `ScrollView` with [View](~/api/Terminal.Gui.View.yml) and use `Viewport` and [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) to control scrolling.
|
|
|
|
|
|
+* 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 assumed `Bounds.Location` was always `Point.Empty`.
|
|
-* Update any code that used `Bounds` to refer to the size of the view's content. Use [View.GetContentSize()](~/api/Terminal.Gui.View.GetContentSize.yml) instead.
|
|
|
|
|
|
+* 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.
|
|
* 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.
|
|
|
|
|
|
## Updated Keyboard API
|
|
## Updated Keyboard API
|
|
|
|
|
|
The API for handling keyboard input is significantly improved. See [Keyboard API](keyboard.md).
|
|
The API for handling keyboard input is significantly improved. See [Keyboard API](keyboard.md).
|
|
|
|
|
|
-* The [Key](~/api/Terminal.Gui.Key.yml) class replaces the `KeyEvent` struct and provides a platform-independent abstraction for common keyboard operations. It is used for processing keyboard input and raising keyboard events. This class provides a high-level abstraction with helper methods and properties for common keyboard operations. Use this class instead of the low-level [KeyCode](~/api/Terminal.Gui.KeyCode.yml) enum when possible. See [Key](~/api/Terminal.Gui.Key.yml) for more details.
|
|
|
|
-* The preferred way to enable Application-wide or View-heirarchy-dependent keystrokes is to use the [Shortcut](~/api/Terminal.Gui.Shortcut.yml) View or the built-in View's that utilize it, such as the [Bar](~/api/Terminal.Gui.Bar.yml)-based views.
|
|
|
|
-* The preferred way to handle single keystrokes is to use **Key Bindings**. Key Bindings map a key press to a [Command](~/api/Terminal.Gui.Command.yml). A view can declare which commands it supports, and provide a lambda that implements the functionality of the command, using `View.AddCommand()`. Use the [View.Keybindings](~/api/Terminal.Gui.View.Keybindings.yml) to configure the key bindings.
|
|
|
|
|
|
+* The @Terminal.Gui.Key class replaces the `KeyEvent` struct and provides a platform-independent abstraction for common keyboard operations. It is used for processing keyboard input and raising keyboard events. This class provides a high-level abstraction with helper methods and properties for common keyboard operations. Use this class instead of the low-level @Terminal.Gui.KeyCode enum when possible. See @Terminal.Gui.Key for more details.
|
|
|
|
+* The preferred way to enable Application-wide or View-heirarchy-dependent keystrokes is to use the @Terminal.Gui.Shortcut View or the built-in View's that utilize it, such as the @Terminal.Gui.Bar-based views.
|
|
|
|
+* The preferred way to handle single keystrokes is to use **Key Bindings**. Key Bindings map a key press to a @Terminal.Gui.Command. A view can declare which commands it supports, and provide a lambda that implements the functionality of the command, using `View.AddCommand()`. Use the @Terminal.Gui.View.Keybindings to configure the key bindings.
|
|
* For better consistency and user experience, the default key for closing an app or `Toplevel` is now `Esc` (it was previously `Ctrl+Q`).
|
|
* For better consistency and user experience, the default key for closing an app or `Toplevel` is now `Esc` (it was previously `Ctrl+Q`).
|
|
* The `Application.RootKeyEvent` method has been replaced with `Application.KeyDown`
|
|
* The `Application.RootKeyEvent` method has been replaced with `Application.KeyDown`
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
* Replace `KeyEvent` with `Key`
|
|
* Replace `KeyEvent` with `Key`
|
|
-* Use [View.AddCommand](~/api/Terminal.Gui.View.AddCommand.yml) to define commands your view supports.
|
|
|
|
-* Use [View.Keybindings](~/api/Terminal.Gui.View.Keybindings.yml) to configure key bindings to `Command`s.
|
|
|
|
|
|
+* Use @Terminal.Gui.View.AddCommand to define commands your view supports.
|
|
|
|
+* Use @Terminal.Gui.View.Keybindings to configure key bindings to `Command`s.
|
|
* It should be very uncommon for v2 code to override `OnKeyPressed` etc...
|
|
* It should be very uncommon for v2 code to override `OnKeyPressed` etc...
|
|
* Anywhere `Ctrl+Q` was hard-coded as the "quit key", replace with `Application.QuitKey`.
|
|
* Anywhere `Ctrl+Q` was hard-coded as the "quit key", replace with `Application.QuitKey`.
|
|
* See *Navigation* below for more information on v2's navigation keys.
|
|
* See *Navigation* below for more information on v2's navigation keys.
|
|
@@ -184,7 +184,7 @@ The API for handling keyboard input is significantly improved. See [Keyboard API
|
|
+ Application.KeyDown(object? sender, Key e)
|
|
+ Application.KeyDown(object? sender, Key e)
|
|
```
|
|
```
|
|
|
|
|
|
-## [Command]((~/api/Terminal.Gui.Command.yml)) has been expanded and simplified
|
|
|
|
|
|
+## **@"Terminal.Gui.Command" has been expanded and simplified
|
|
|
|
|
|
In v1, the `Command` enum had duplicate entries and inconsistent naming. In v2 it has been both expanded and simplified.
|
|
In v1, the `Command` enum had duplicate entries and inconsistent naming. In v2 it has been both expanded and simplified.
|
|
|
|
|
|
@@ -196,18 +196,18 @@ In v1, the `Command` enum had duplicate entries and inconsistent naming. In v2 i
|
|
|
|
|
|
The API for mouse input is now internally consistent and easier to use.
|
|
The API for mouse input is now internally consistent and easier to use.
|
|
|
|
|
|
-* The [MouseEvent](~/api/Terminal.Gui.MouseEvent.yml) class replaces `MouseEventEventArgs`.
|
|
|
|
|
|
+* The @Terminal.Gui.MouseEvent class replaces `MouseEventEventArgs`.
|
|
* More granular APIs are provided to ease handling specific mouse actions. See [Mouse API](mouse.md).
|
|
* More granular APIs are provided to ease handling specific mouse actions. See [Mouse API](mouse.md).
|
|
-* Views can use the [View.Highlight](~/api/Terminal.Gui.View.Highlight.yml) event to have the view be visibly highlighted on various mouse events.
|
|
|
|
-* Views can set `View.WantContinousButtonPresses = true` to have their [Command.Accept](~/api/Terminal.Gui.Command.Accept.yml) command be invoked repeatedly as the user holds a mouse button down on the view.
|
|
|
|
|
|
+* Views can use the @Terminal.Gui.View.Highlight event to have the view be visibly highlighted on various mouse events.
|
|
|
|
+* Views can set `View.WantContinousButtonPresses = true` to have their @Terminal.Gui.Command.Accept command be invoked repeatedly as the user holds a mouse button down on the view.
|
|
* Mouse and draw events now provide coordinates relative to the `Viewport` not the `Screen`.
|
|
* Mouse and draw events now provide coordinates relative to the `Viewport` not the `Screen`.
|
|
* The `Application.RootMouseEvent` method has been replaced with `Application.MouseEvent`
|
|
* The `Application.RootMouseEvent` method has been replaced with `Application.MouseEvent`
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
* Replace `MouseEventEventArgs` with `MouseEvent`
|
|
* Replace `MouseEventEventArgs` with `MouseEvent`
|
|
-* Use the [View.Highlight](~/api/Terminal.Gui.View.Highlight.yml) event to have the view be visibly highlighted on various mouse events.
|
|
|
|
-* Set `View.WantContinousButtonPresses = true` to have the [Command.Accept](~/api/Terminal.Gui.Command.Accept.yml) command be invoked repeatedly as the user holds a mouse button down on the view.
|
|
|
|
|
|
+* Use the @Terminal.Gui.View.Highlight event to have the view be visibly highlighted on various mouse events.
|
|
|
|
+* Set `View.WantContinousButtonPresses = true` to have the @Terminal.Gui.Command.Accept command be invoked repeatedly as the user holds a mouse button down on the view.
|
|
* Update any code that assumed mouse events provided coordinates relative to the `Screen`.
|
|
* Update any code that assumed mouse events provided coordinates relative to the `Screen`.
|
|
* Replace `Application.RootMouseEvent` with `Application.MouseEvent`.
|
|
* Replace `Application.RootMouseEvent` with `Application.MouseEvent`.
|
|
|
|
|
|
@@ -238,8 +238,8 @@ In v2, the API is (NOT YET IMPLEMENTED) simplified. A view simply reports the st
|
|
|
|
|
|
#### How to Fix (Cursor API)
|
|
#### How to Fix (Cursor API)
|
|
|
|
|
|
-* Use [View.CursorPosition](~/api/Terminal.Gui.View.CursorPosition.yml) to set the cursor position in a view. Set [View.CursorPosition](~/api/Terminal.Gui.View.CursorPosition.yml) to `null` to hide the cursor.
|
|
|
|
-* Set [View.CursorVisibility](~/api/Terminal.Gui.View.CursorVisibility.yml) to the cursor style you want to use.
|
|
|
|
|
|
+* Use @Terminal.Gui.View.CursorPosition to set the cursor position in a view. Set @Terminal.Gui.View.CursorPosition to `null` to hide the cursor.
|
|
|
|
+* Set @Terminal.Gui.View.CursorVisibility to the cursor style you want to use.
|
|
* Remove any overrides of `OnEnter` and `OnLeave` that explicitly change the cursor.
|
|
* Remove any overrides of `OnEnter` and `OnLeave` that explicitly change the cursor.
|
|
|
|
|
|
### Focus
|
|
### Focus
|
|
@@ -262,8 +262,8 @@ See also [Keyboard](keyboard.md) where HotKey is covered more deeply...
|
|
|
|
|
|
### How to Fix (Focus API)
|
|
### How to Fix (Focus API)
|
|
|
|
|
|
-* Use [Application.Navigation.GetFocused()](~/api/Terminal.Gui.Application.Navigation.GetFocused.yml) to get the most focused view in the application.
|
|
|
|
-* Use [Application.Navigation.AdvanceFocus()](~/api/Terminal.Gui.Application.Navigation.AdvanceFocus.yml) to cause focus to change.
|
|
|
|
|
|
+* Use @Terminal.Gui.Application.Navigation.GetFocused to get the most focused view in the application.
|
|
|
|
+* Use @Terminal.Gui.Application.Navigation.AdvanceFocus to cause focus to change.
|
|
|
|
|
|
### Keyboard Navigation
|
|
### Keyboard Navigation
|
|
|
|
|
|
@@ -371,19 +371,19 @@ Replace references to nested types with the new standalone version
|
|
|
|
|
|
## View and Text Alignment Changes
|
|
## View and Text Alignment Changes
|
|
|
|
|
|
-In v1, both `TextAlignment` and `VerticalTextAlignment` enums were used to align text in views. In v2, these enums have been replaced with the [Alignment](~/api/Terminal.Gui.Alignment.yml) enum. The [View.TextAlignment](~/api/Terminal.Gui.View.TextAlignment.yml) property controls horizontal text alignment and the [View.VerticalTextAlignment](~/api/Terminal.Gui.View.VerticalTextAlignment.yml) property controls vertical text alignment.
|
|
|
|
|
|
+In v1, both `TextAlignment` and `VerticalTextAlignment` enums were used to align text in views. In v2, these enums have been replaced with the @Terminal.Gui.Alignment enum. The @Terminal.Gui.View.TextAlignment property controls horizontal text alignment and the @Terminal.Gui.View.VerticalTextAlignment property controls vertical text alignment.
|
|
|
|
|
|
-v2 now supports [Pos.Align](~/api/Terminal.Gui.Pos.Align.yml) which enables views to be easily aligned within their Superview.
|
|
|
|
|
|
+v2 now supports @Terminal.Gui.Pos.Align which enables views to be easily aligned within their Superview.
|
|
|
|
|
|
-The [Aligner](~/api/Terminal.Gui.Aligner.yml) class makes it easy to align elements (text, Views, etc...) within a container.
|
|
|
|
|
|
+The @Terminal.Gui.Aligner class makes it easy to align elements (text, Views, etc...) within a container.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
-* Replace `VerticalAlignment.Middle` is now [Alignment.Center](~/api/Terminal.Gui.Alignment.Center.yml).
|
|
|
|
|
|
+* Replace `VerticalAlignment.Middle` is now @Terminal.Gui.Alignment.Center.
|
|
|
|
|
|
## `StatusBar`- `StatusItem` is replaced by `Shortcut`
|
|
## `StatusBar`- `StatusItem` is replaced by `Shortcut`
|
|
|
|
|
|
-[StatusBar](~/api/Terminal.Gui.StatusBar.yml) has been upgraded to utilize [Shortcut](~/api/Terminal.Gui.Shortcut.yml).
|
|
|
|
|
|
+@Terminal.Gui.StatusBar has been upgraded to utilize @Terminal.Gui.Shortcut.
|
|
|
|
|
|
### How to Fix
|
|
### How to Fix
|
|
|
|
|
|
@@ -455,11 +455,11 @@ In v2, these methods have been named correctly.
|
|
|
|
|
|
## `Mdi` Replaced by `ViewArrangement.Overlapped`
|
|
## `Mdi` Replaced by `ViewArrangement.Overlapped`
|
|
|
|
|
|
-In v1, it apps with multiple overlapping views could be created using a set of APIs spread across `Application` (e.g. `Application.MdiTop`) and `Toplevel` (e.g. `IsMdiContainer`). This functionality has been replaced in v2 with [View.Arrangement](~/api/Terminal.Gui.View.Arrangement.yml). Specifically, overlapped views with [View.Arrangement](~/api/Terminal.Gui.View.Arrangement.yml) having the [ViewArrangement.Overlapped](~/api/Terminal.Gui.ViewArrangement.Overlapped.yml) flag set will be arranged in an overlapped fashion using the order in their SuperView's subview list as the Z-order.
|
|
|
|
|
|
+In v1, it apps with multiple overlapping views could be created using a set of APIs spread across `Application` (e.g. `Application.MdiTop`) and `Toplevel` (e.g. `IsMdiContainer`). This functionality has been replaced in v2 with @Terminal.Gui.View.Arrangement. Specifically, overlapped views with @Terminal.Gui.View.Arrangement having the @Terminal.Gui.ViewArrangement.Overlapped flag set will be arranged in an overlapped fashion using the order in their SuperView's subview list as the Z-order.
|
|
|
|
|
|
-Setting the [ViewArrangement.Movable](~/api/Terminal.Gui.ViewArrangement.Movable.yml) flag will enable the overlapped views to be movable with the mouse or keyboard (`Ctrl+F5` to activate).
|
|
|
|
|
|
+Setting the @Terminal.Gui.ViewArrangement.Movable flag will enable the overlapped views to be movable with the mouse or keyboard (`Ctrl+F5` to activate).
|
|
|
|
|
|
-Setting the [ViewArrangement.Sizable](~/api/Terminal.Gui.ViewArrangement.Sizable.yml) flag will enable the overlapped views to be resized with the mouse or keyboard (`Ctrl+F5` to activate).
|
|
|
|
|
|
+Setting the @Terminal.Gui.ViewArrangement.Sizable flag will enable the overlapped views to be resized with the mouse or keyboard (`Ctrl+F5` to activate).
|
|
|
|
|
|
In v1, only Views derived from `Toplevel` could be overlapped. In v2, any view can be.
|
|
In v1, only Views derived from `Toplevel` could be overlapped. In v2, any view can be.
|
|
|
|
|
|
@@ -471,6 +471,6 @@ v1 conflated the concepts of
|
|
|
|
|
|
* To simplify programming, any `View` added as a Subview another `View` will have it's lifecycle owned by the Superview; when a `View` is disposed, it will call `Dispose` on all the items in the `Subviews` property. Note this behavior is the same as it was in v1, just clarified.
|
|
* To simplify programming, any `View` added as a Subview another `View` will have it's lifecycle owned by the Superview; when a `View` is disposed, it will call `Dispose` on all the items in the `Subviews` property. Note this behavior is the same as it was in v1, just clarified.
|
|
|
|
|
|
-* In v1, [Application.End](~/api/Terminal.Gui.Application.Run.yml) called `Dispose ()` on [Application.Top](~/api/Terminal.Gui.Application.Top.yml) (via `Runstate.Toplevel`). This was incorrect as it meant that after `Application.Run` returned, `Application.Top` had been disposed, and any code that wanted to interrogate the results of `Run` by accessing `Application.Top` only worked by accident. This is because GC had not actually happened; if it had the application would have crashed. In v2 `Application.End` does NOT call `Dispose`, and it is the caller to `Application.Run` who is responsible for disposing the `Toplevel` that was either passed to `Application.Run (View)` or created by `Application.Run<T> ()`.
|
|
|
|
|
|
+* In v1, `Application.End` called `Dispose ()` on @Terminal.Gui.Application.Top (via `Runstate.Toplevel`). This was incorrect as it meant that after `Application.Run` returned, `Application.Top` had been disposed, and any code that wanted to interrogate the results of `Run` by accessing `Application.Top` only worked by accident. This is because GC had not actually happened; if it had the application would have crashed. In v2 `Application.End` does NOT call `Dispose`, and it is the caller to `Application.Run` who is responsible for disposing the `Toplevel` that was either passed to `Application.Run (View)` or created by `Application.Run<T> ()`.
|
|
|
|
|
|
* Any code that creates a `Toplevel`, either by using `top = new()` or by calling either `top = Application.Run ()` or `top = ApplicationRun<T>()` must call `top.Dispose` when complete. The exception to this is if `top` is passed to `myView.Add(top)` making it a subview of `myView`. This is because the semantics of `Add` are that the `myView` takes over responsibility for the subviews lifetimes. Of course, if someone calls `myView.Remove(top)` to remove said subview, they then re-take responsbility for `top`'s lifetime and they must call `top.Dispose`.
|
|
* Any code that creates a `Toplevel`, either by using `top = new()` or by calling either `top = Application.Run ()` or `top = ApplicationRun<T>()` must call `top.Dispose` when complete. The exception to this is if `top` is passed to `myView.Add(top)` making it a subview of `myView`. This is because the semantics of `Add` are that the `myView` takes over responsibility for the subviews lifetimes. Of course, if someone calls `myView.Remove(top)` to remove said subview, they then re-take responsbility for `top`'s lifetime and they must call `top.Dispose`.
|