Browse Source

Update docs with keybindings, global key event and designer (#1869)

* Added docs on keybinding and global key event

* Added TerminalGuiDesigner to showcases/examples
Thomas Nind 3 years ago
parent
commit
b5cf92d5df
2 changed files with 29 additions and 0 deletions
  1. 1 0
      README.md
  2. 28 0
      docfx/articles/keyboard.md

+ 1 - 0
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
 

+ 28 - 0
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.