|
@@ -64,8 +64,8 @@ namespace Terminal.Gui
|
|
|
|
|
|
/// <summary>Method that invoke the <see cref="TextChanged"/> event if it's defined.</summary>
|
|
/// <summary>Method that invoke the <see cref="TextChanged"/> event if it's defined.</summary>
|
|
/// <param name="oldValue">The previous text before replaced.</param>
|
|
/// <param name="oldValue">The previous text before replaced.</param>
|
|
- /// <returns>Returns the <see cref="StringEventArgs"/></returns>
|
|
|
|
- void OnTextChanged (StringEventArgs oldValue);
|
|
|
|
|
|
+ /// <returns>Returns the <see cref="CancelEventArgs{T}"/></returns>
|
|
|
|
+ void OnTextChanged (CancelEventArgs<string> oldValue);
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Changed event, raised when the text has changed.
|
|
/// Changed event, raised when the text has changed.
|
|
@@ -74,7 +74,7 @@ namespace Terminal.Gui
|
|
/// <see cref="string"/> containing the old value.
|
|
/// <see cref="string"/> containing the old value.
|
|
/// </remarks>
|
|
/// </remarks>
|
|
/// </summary>
|
|
/// </summary>
|
|
- event EventHandler<StringEventArgs> TextChanged;
|
|
|
|
|
|
+ event EventHandler<CancelEventArgs<string>> TextChanged;
|
|
}
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
@@ -125,7 +125,7 @@ namespace Terminal.Gui
|
|
}
|
|
}
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
- public event EventHandler<StringEventArgs> TextChanged;
|
|
|
|
|
|
+ public event EventHandler<CancelEventArgs<string>> TextChanged;
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
public string Text
|
|
public string Text
|
|
@@ -206,7 +206,7 @@ namespace Terminal.Gui
|
|
|
|
|
|
if (result)
|
|
if (result)
|
|
{
|
|
{
|
|
- OnTextChanged (new StringEventArgs { NewValue = oldValue });
|
|
|
|
|
|
+ OnTextChanged (new CancelEventArgs<string> (oldValue, Text));
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
@@ -220,14 +220,14 @@ namespace Terminal.Gui
|
|
|
|
|
|
if (result)
|
|
if (result)
|
|
{
|
|
{
|
|
- OnTextChanged (new StringEventArgs { NewValue = oldValue });
|
|
|
|
|
|
+ OnTextChanged (new CancelEventArgs<string> (oldValue, Text));
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
- public void OnTextChanged (StringEventArgs oldValue) { TextChanged?.Invoke (this, oldValue); }
|
|
|
|
|
|
+ public void OnTextChanged (CancelEventArgs<string> args) { TextChanged?.Invoke (this, args); }
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
@@ -260,7 +260,7 @@ namespace Terminal.Gui
|
|
public bool ValidateOnInput { get; set; } = true;
|
|
public bool ValidateOnInput { get; set; } = true;
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
- public event EventHandler<StringEventArgs> TextChanged;
|
|
|
|
|
|
+ public event EventHandler<CancelEventArgs<string>> TextChanged;
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
public string Text
|
|
public string Text
|
|
@@ -333,7 +333,7 @@ namespace Terminal.Gui
|
|
{
|
|
{
|
|
string oldValue = Text;
|
|
string oldValue = Text;
|
|
_text.RemoveAt (pos);
|
|
_text.RemoveAt (pos);
|
|
- OnTextChanged (new StringEventArgs { NewValue = Text, OldValue = oldValue });
|
|
|
|
|
|
+ OnTextChanged (new CancelEventArgs<string> (oldValue, Text));
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -349,7 +349,7 @@ namespace Terminal.Gui
|
|
{
|
|
{
|
|
string oldValue = Text;
|
|
string oldValue = Text;
|
|
_text.Insert (pos, (Rune)ch);
|
|
_text.Insert (pos, (Rune)ch);
|
|
- OnTextChanged (new StringEventArgs { NewValue = Text, OldValue = oldValue });
|
|
|
|
|
|
+ OnTextChanged (new CancelEventArgs<string> (oldValue, Text));
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -358,7 +358,7 @@ namespace Terminal.Gui
|
|
}
|
|
}
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
- public void OnTextChanged (StringEventArgs oldValue) { TextChanged?.Invoke (this, oldValue); }
|
|
|
|
|
|
+ public void OnTextChanged (CancelEventArgs<string> args) { TextChanged?.Invoke (this, args); }
|
|
|
|
|
|
/// <summary>Compiles the regex pattern for validation./></summary>
|
|
/// <summary>Compiles the regex pattern for validation./></summary>
|
|
private void CompileMask () { _regex = new Regex (StringExtensions.ToString (_pattern), RegexOptions.Compiled); }
|
|
private void CompileMask () { _regex = new Regex (StringExtensions.ToString (_pattern), RegexOptions.Compiled); }
|