mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Conceptual docs
This commit is contained in:
@@ -296,18 +296,18 @@ These keys are all registered as `KeyBindingScope.Application` key bindings by `
|
||||
|
||||
## Button.Clicked Event Renamed
|
||||
|
||||
The `Button.Clicked` event has been renamed `Button.Accept`
|
||||
The `Button.Clicked` event has been renamed `Button.Accepting`
|
||||
|
||||
## How to Fix
|
||||
|
||||
Rename all instances of `Button.Clicked` to `Button.Accept`. Note the signature change to mouse events below.
|
||||
Rename all instances of `Button.Clicked` to `Button.Accepting`. Note the signature change to mouse events below.
|
||||
|
||||
```diff
|
||||
- btnLogin.Clicked
|
||||
+ btnLogin.Accept
|
||||
+ btnLogin.Accepting
|
||||
```
|
||||
|
||||
Alternatively, if you want to have key events as well as mouse events to fire an event, use `Button.Accept`.
|
||||
Alternatively, if you want to have key events as well as mouse events to fire an event, use `Button.Accepting`.
|
||||
|
||||
## Events now use `object sender, EventArgs args` signature
|
||||
|
||||
@@ -341,7 +341,7 @@ If you previously had a lambda expression, you can simply add the extra argument
|
||||
|
||||
```diff
|
||||
- btnLogin.Clicked += () => { /*do something*/ };
|
||||
+ btnLogin.Accept += (s,e) => { /*do something*/ };
|
||||
+ btnLogin.Accepting += (s,e) => { /*do something*/ };
|
||||
```
|
||||
Note that the event name has also changed as noted above.
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ The `Dialogs` Scenario is illustrative:
|
||||
For the `app` (Window):
|
||||
|
||||
```cs
|
||||
showDialogButton.Accept += (s, e) =>
|
||||
showDialogButton.Accepting += (s, e) =>
|
||||
{
|
||||
Dialog dlg = CreateDemoDialog (
|
||||
widthEdit,
|
||||
@@ -503,7 +503,7 @@ For the `app` (Window):
|
||||
Changing this to
|
||||
|
||||
```cs
|
||||
app.Accept += (s, e) =>
|
||||
app.Accepting += (s, e) =>
|
||||
{
|
||||
Dialog dlg = CreateDemoDialog (
|
||||
widthEdit,
|
||||
@@ -524,7 +524,7 @@ Changing this to
|
||||
However, for `Dialog` the `Dialogs` scenario illustrates why a dev might actually want multiple buttons and to have one be `Default`:
|
||||
|
||||
```cs
|
||||
button.Accept += (s, e) =>
|
||||
button.Accepting += (s, e) =>
|
||||
{
|
||||
clicked = buttonId;
|
||||
Application.RequestStop ();
|
||||
|
||||
Reference in New Issue
Block a user