mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Initial plan
* Rename Command.Select to Command.Activate and Selecting to Activating
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add Activating event propagation to SuperView
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update all comments and docs referencing Select to Activate
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix event log messages in examples to use Activating/Activate
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Revert automatic Activating event propagation that broke tests
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update docfx documentation to use Activate/Activating terminology
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* renames
* Revert "Add Activating event propagation to SuperView"
This reverts commit 6d82bee9ad.
* added command diagrams
* mermaid
* updated level 3
* again
* Select->Activate in MouseTests.cs
* Update Terminal.Gui/Views/Selectors/FlagSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor: Rename Selecting to Activating in View APIs
Renamed the `Selecting` event and `OnSelecting` method to
`Activating` and `OnActivating` to better reflect their purpose.
Updated all related comments, test method names, variables,
and assertions in `View` and `ViewCommandTests` to align with
the new terminology.
Improved code clarity by using `_` for unused parameters in
lambda expressions. Renamed properties like `HandleSelecting`
to `HandleActivating` and adjusted naming conventions for
consistency (e.g., `OnactivatingCount` to `OnActivatingCount`).
These changes enhance readability, maintainability, and
terminology consistency across the codebase.
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Typos
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -577,9 +577,9 @@ view.MouseClick += (mouseEvent) =>
|
||||
|
||||
**v2:**
|
||||
```csharp
|
||||
// v2 - Use MouseBindings + Commands + Selecting event
|
||||
view.MouseBindings.Add(MouseFlags.Button1Clicked, Command.Select);
|
||||
view.Selecting += (s, e) =>
|
||||
// v2 - Use MouseBindings + Commands + Activating event
|
||||
view.MouseBindings.Add(MouseFlags.Button1Clicked, Command.Activate);
|
||||
view.Activating += (s, e) =>
|
||||
{
|
||||
// Handle selection (called when Button1Clicked)
|
||||
DoSomething();
|
||||
@@ -599,8 +599,8 @@ view.MouseEvent += (s, e) =>
|
||||
**Key Changes:**
|
||||
- `View.MouseClick` event has been **removed**
|
||||
- Use `MouseBindings` to map mouse events to `Command`s
|
||||
- Default mouse bindings invoke `Command.Select` which raises the `Selecting` event
|
||||
- For custom behavior, override `OnSelecting` or subscribe to the `Selecting` event
|
||||
- Default mouse bindings invoke `Command.Activate` which raises the `Activating` event
|
||||
- For custom behavior, override `OnActivating` or subscribe to the `Activating` event
|
||||
- For low-level mouse handling, use `MouseEvent` directly
|
||||
|
||||
**Migration Pattern:**
|
||||
@@ -616,8 +616,8 @@ protected override bool OnMouseClick(MouseEventArgs mouseEvent)
|
||||
return base.OnMouseClick(mouseEvent);
|
||||
}
|
||||
|
||||
// ✅ v2 - OnSelecting override
|
||||
protected override bool OnSelecting(CommandEventArgs args)
|
||||
// ✅ v2 - OnActivating override
|
||||
protected override bool OnActivating(CommandEventArgs args)
|
||||
{
|
||||
if (args.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
|
||||
{
|
||||
@@ -628,20 +628,20 @@ protected override bool OnSelecting(CommandEventArgs args)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return base.OnSelecting(args);
|
||||
return base.OnActivating(args);
|
||||
}
|
||||
|
||||
// ✅ v2 - Selecting event (simpler)
|
||||
view.Selecting += (s, e) =>
|
||||
// ✅ v2 - Activating event (simpler)
|
||||
view.Activating += (s, e) =>
|
||||
{
|
||||
PerformAction();
|
||||
e.Handled = true;
|
||||
};
|
||||
```
|
||||
|
||||
**Accessing Mouse Position in Selecting Event:**
|
||||
**Accessing Mouse Position in Activating Event:**
|
||||
```csharp
|
||||
view.Selecting += (s, e) =>
|
||||
view.Activating += (s, e) =>
|
||||
{
|
||||
// Extract mouse event args from command context
|
||||
if (e.Context is CommandContext<MouseBinding> { Binding.MouseEventArgs: { } mouseArgs })
|
||||
|
||||
Reference in New Issue
Block a user