Fix BeatmapListingOverlay not taking focus

This commit is contained in:
Dean Herbert 2020-04-21 15:47:43 +09:00
parent c3b36d8f20
commit 594cef1473
3 changed files with 15 additions and 1 deletions

View File

@ -159,5 +159,7 @@ protected override void Dispose(bool isDisposing)
base.Dispose(isDisposing);
}
public void TakeFocus() => searchControl.TakeFocus();
}
}

View File

@ -121,6 +121,8 @@ private void load(OverlayColourProvider colourProvider)
background.Colour = colourProvider.Dark6;
}
public void TakeFocus() => textBox.TakeFocus();
private class BeatmapSearchTextBox : SearchTextBox
{
protected override Color4 SelectionColour => Color4.Gray;

View File

@ -10,6 +10,7 @@
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
@ -35,6 +36,8 @@ public BeatmapListingOverlay()
{
}
private BeatmapListingFilterControl filterControl;
[BackgroundDependencyLoader]
private void load()
{
@ -57,7 +60,7 @@ private void load()
Children = new Drawable[]
{
new BeatmapListingHeader(),
new BeatmapListingFilterControl
filterControl = new BeatmapListingFilterControl
{
SearchStarted = onSearchStarted,
SearchFinished = onSearchFinished,
@ -88,6 +91,13 @@ private void load()
};
}
protected override void OnFocus(FocusEvent e)
{
base.OnFocus(e);
filterControl.TakeFocus();
}
private CancellationTokenSource cancellationToken;
private void onSearchStarted()