mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixed docs
This commit is contained in:
@@ -10,8 +10,8 @@ namespace Terminal.Gui;
|
||||
/// <remarks>
|
||||
/// To run the <see cref="Dialog"/> modally, create the <see cref="Dialog"/>, and pass it to
|
||||
/// <see cref="Application.Run(Toplevel, Func{Exception, bool})"/>. This will execute the dialog until
|
||||
/// it terminates via the
|
||||
/// [ESC] or [CTRL-Q] key, or when one of the views or buttons added to the dialog calls
|
||||
/// it terminates via the <see cref="Application.QuitKey"/> (`Esc` by default),
|
||||
/// or when one of the views or buttons added to the dialog calls
|
||||
/// <see cref="Application.RequestStop"/>.
|
||||
/// </remarks>
|
||||
public class Dialog : Window
|
||||
|
||||
@@ -54,11 +54,13 @@ public sealed class KeyBindings : Scenario
|
||||
Height = Dim.Auto (DimAutoStyle.Text),
|
||||
HotKeySpecifier = (Rune)'_',
|
||||
Title = "_KeyBindingsDemo",
|
||||
Text = @"These keys will cause this view to show a message box:
|
||||
- Hotkey: k, K, Alt-K, Alt-Shift-K
|
||||
- Focused: F3
|
||||
- Application: F4
|
||||
Pressing Ctrl-Q will cause it to quit the app.",
|
||||
Text = $"""
|
||||
These keys will cause this view to show a message box:
|
||||
- Hotkey: k, K, Alt-K, Alt-Shift-K
|
||||
- Focused: F3
|
||||
- Application: F4
|
||||
Pressing Esc or {Application.QuitKey} will cause it to quit the app.
|
||||
""",
|
||||
BorderStyle = LineStyle.Dashed
|
||||
};
|
||||
appWindow.Add (keyBindingsDemo);
|
||||
|
||||
@@ -57,16 +57,14 @@ public class MenuBarScenario : Scenario
|
||||
),
|
||||
null,
|
||||
|
||||
// Don't use Ctrl-Q so we can disambiguate between quitting and closing the toplevel
|
||||
// Don't use Application.Quit so we can disambiguate between quitting and closing the toplevel
|
||||
new (
|
||||
"_Quit",
|
||||
"",
|
||||
() => actionFn ("Quit"),
|
||||
null,
|
||||
null,
|
||||
KeyCode.AltMask
|
||||
| KeyCode.CtrlMask
|
||||
| KeyCode.Q
|
||||
KeyCode.CtrlMask | KeyCode.Q
|
||||
)
|
||||
}
|
||||
),
|
||||
|
||||
@@ -203,7 +203,7 @@ public class SingleBackgroundWorker : Scenario
|
||||
|
||||
_top.KeyDown += (s, e) =>
|
||||
{
|
||||
// Prevents Ctrl+Q from closing this.
|
||||
// Prevents App.QuitKey from closing this.
|
||||
// Only Ctrl+C is allowed.
|
||||
if (e == Application.QuitKey)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,7 @@ The API for handling keyboard input is significantly improved. See [Keyboard API
|
||||
* 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.
|
||||
* For better consistency and user experience, the default key for closing an app or `Toplevel` is now `Esc` (it was previously `Ctrl+Q`).
|
||||
|
||||
### How to Fix
|
||||
|
||||
@@ -173,6 +174,7 @@ The API for handling keyboard input is significantly improved. See [Keyboard API
|
||||
* 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.
|
||||
* 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`.
|
||||
|
||||
## Updated Mouse API
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ The API for handling keyboard input is significantly improved. See [Keyboard API
|
||||
|
||||
* The `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 `KeyCode` enum when possible. See [Key](~/api/Terminal.Gui.Key.yml) for more details.
|
||||
* 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` 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`).
|
||||
|
||||
## Updated Mouse API
|
||||
|
||||
|
||||
Reference in New Issue
Block a user