Merge branch 'event-for-keydown-textbox' of https://github.com/Tryibion/FlaxEngine into Tryibion-event-for-keydown-textbox

This commit is contained in:
Wojtek Figat
2022-10-29 19:05:07 +02:00

View File

@@ -129,6 +129,16 @@ namespace FlaxEngine.GUI
/// </summary>
public event Action<TextBoxBase> TextBoxEditEnd;
/// <summary>
/// Event fired when a key is down.
/// </summary>
public event Action<KeyboardKeys> KeyDown;
/// <summary>
/// Event fired when a key is up.
/// </summary>
public event Action<KeyboardKeys> KeyUp;
/// <summary>
/// Gets or sets a value indicating whether this is a multiline text box control.
/// </summary>
@@ -1168,12 +1178,20 @@ namespace FlaxEngine.GUI
return true;
}
/// <inheritdoc />
public override void OnKeyUp(KeyboardKeys key)
{
base.OnKeyUp(key);
KeyUp?.Invoke(key);
}
/// <inheritdoc />
public override bool OnKeyDown(KeyboardKeys key)
{
var window = Root;
bool shiftDown = window.GetKey(KeyboardKeys.Shift);
bool ctrDown = window.GetKey(KeyboardKeys.Control);
KeyDown?.Invoke(key);
switch (key)
{