@@ -12,7 +12,7 @@ namespace Terminal.Gui;
/// should be set to
/// <see langword="true"/> to prevent the state change from occurring.
/// </remarks>
-public class CancelEventArgs<T> : CancelEventArgs where T : notnull
+public class CancelEventArgs<T> : CancelEventArgs
{
/// <summary>Initializes a new instance of the <see cref="CancelEventArgs{T}"/> class.</summary>
/// <param name="currentValue">The current (old) value of the property.</param>
@@ -69,18 +69,17 @@ public partial class View
Id = _text;
}
#endif
- OnTextChanged (old, Text);
+ OnTextChanged (new CancelEventArgs<string> (old, Text));
/// <summary>
/// Called when the <see cref="Text"/> has changed. Fires the <see cref="TextChanged"/> event.
/// </summary>
- /// <param name="oldValue"></param>
- /// <param name="newValue"></param>
- public void OnTextChanged (string oldValue, string newValue)
+ /// <param name="args">The event arguments</param>
+ public void OnTextChanged (CancelEventArgs<string> args)
- TextChanged?.Invoke (this, new CancelEventArgs<string> (oldValue, newValue));
+ TextChanged?.Invoke (this, args);
@@ -563,7 +563,7 @@ public class TextField : View
);
- OnTextChanged (oldText, StringExtensions.ToString (_text));
+ OnTextChanged (new (oldText, StringExtensions.ToString (_text)));
ProcessAutocomplete ();
@@ -2830,7 +2830,7 @@ public class TextView : View
_model = _wrapManager.WrapModel (Viewport.Width, out _, out _, out _, out _);
+ OnTextChanged (new (old, Text));
SetNeedsDisplay ();
_historyText.Clear (Text);