diff --git a/README.md b/README.md index 4a3524d9f..ac81a50b2 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ You can force the use of `System.Console` on Unix as well; see `Core.cs`. * **[F# Example](https://github.com/migueldeicaza/gui.cs/tree/master/FSharpExample)** - An example showing how to build a Terminal.Gui app using F#. * **[PowerShell's `Out-ConsoleGridView`](https://github.com/PowerShell/GraphicalTools/blob/master/docs/Microsoft.PowerShell.ConsoleGuiTools/Out-ConsoleGridView.md)** - `OCGV` sends the output from a command to an interactive table. * **[PoshRedisViewer](https://github.com/En3Tho/PoshRedisViewer)** - A compact Redis viewer module for PowerShell written in F# and Gui.cs +* **[TerminalGuiDesigner](https://github.com/tznind/TerminalGuiDesigner)** - Cross platform view designer for building Terminal.Gui applications. ## Documentation diff --git a/docfx/articles/keyboard.md b/docfx/articles/keyboard.md index 2872d1dcd..839ac24a4 100644 --- a/docfx/articles/keyboard.md +++ b/docfx/articles/keyboard.md @@ -44,3 +44,31 @@ This method can be overwritten by views that want to provide accelerator functionality (Alt-key for example), but without interefering with normal ProcessKey behavior. +Key Bindings +------------------- +**Terminal.Gui** supports rebinding keys. For example the default key +for activating a button is Enter. You can change this using the +`ClearKeybinding` and `AddKeybinding` methods: + +```csharp +var btn = new Button ("Press Me"); +btn.ClearKeybinding (Command.Accept); +btn.AddKeyBinding (Key.b, Command.Accept); +``` + +The `Command` enum lists generic operations that are implemented by views. +For example `Command.Accept` in a Button results in the `Clicked` event +firing while in `TableView` it is bound to `CellActivated`. Not all commands +are implemented by all views (e.g. you cannot scroll in a Button). To see +which commands are implemented by a View you can use the `GetSupportedCommands()` +method. + +Not all controls have the same key bound for a given command, for example +`Command.Accept` defaults to `Key.Enter` in a `Button` but defaults to `Key.Space` +in `RadioGroup`. + +Global Key Handler +-------------------- +Sometimes you may want to define global key handling logic for your entire +application that is invoked regardless of what Window/View has focus. This can +be achieved by using the `Application.RootKeyEvent` event.