Add Tab navigation for Editor UI
This commit is contained in:
@@ -220,6 +220,14 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called to cancel action and close the dialog.
|
||||
/// </summary>
|
||||
public virtual void OnCancel()
|
||||
{
|
||||
Close(DialogResult.Cancel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes dialog with the specified result.
|
||||
/// </summary>
|
||||
@@ -243,6 +251,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
/// </summary>
|
||||
protected virtual void OnShow()
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -254,5 +263,37 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSubmit()
|
||||
{
|
||||
base.OnSubmit();
|
||||
|
||||
Close(DialogResult.OK);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnKeyDown(KeyboardKeys key)
|
||||
{
|
||||
if (base.OnKeyDown(key))
|
||||
return true;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case KeyboardKeys.Return:
|
||||
if (Root?.FocusedControl != null)
|
||||
Root.SubmitFocused();
|
||||
else
|
||||
OnSubmit();
|
||||
return true;
|
||||
case KeyboardKeys.Escape:
|
||||
OnCancel();
|
||||
return true;
|
||||
case KeyboardKeys.Tab:
|
||||
Root?.Navigate(NavDirection.Next);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user