Add keyboard key navigation to Content View based on items name first character
This commit is contained in:
@@ -689,6 +689,30 @@ namespace FlaxEditor.Content.GUI
|
|||||||
return base.OnKeyDown(key);
|
return base.OnKeyDown(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnCharInput(char c)
|
||||||
|
{
|
||||||
|
if (base.OnCharInput(c))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (char.IsLetterOrDigit(c) && _items.Count != 0)
|
||||||
|
{
|
||||||
|
// Jump to the item starting with this character
|
||||||
|
c = char.ToLowerInvariant(c);
|
||||||
|
for (int i = 0; i < _items.Count; i++)
|
||||||
|
{
|
||||||
|
var name = _items[i].ShortName;
|
||||||
|
if (!string.IsNullOrEmpty(name) && char.ToLowerInvariant(name[0]) == c)
|
||||||
|
{
|
||||||
|
Select(_items[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void PerformLayoutBeforeChildren()
|
protected override void PerformLayoutBeforeChildren()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user